I have written to a code that can help me to process the data further. But I dont know why I cant select the cells. I get an error
Run-time error '1004':
Application-defined or object-defined error
Please view my code below
Sub CommandButton1_Click()
Dim day_a, day_b As Date, point As String, east_a, north_a, height_a, height_b, east_b, north_b As Double
Dim i1, i2, i3, i4, i5, i6, i7 As Variant
i1 = 1: i2 = 1
Worksheets("INPUT").Cells(i1, i2).Select
Do While Not IsEmpty(ActiveCell)
Worksheets("INPUT").Cells(i1, i2).Activate
If ActiveCell.Value = "Id" Then
i3 = Split(ActiveCell.Address(columnAbsolute:=True, ReferenceStyle:=xlR1C1), "C")(1)
MsgBox (cellidrow)
ElseIf ActiveCell.Value = "Nord" Then
i4 = Split(ActiveCell.Address(columnAbsolute:=True, ReferenceStyle:=xlR1C1), "C")(1)
ElseIf ActiveCell.Value = "Øst" Then
i5 = Split(ActiveCell.Address(columnAbsolute:=True, ReferenceStyle:=xlR1C1), "C")(1)
ElseIf ActiveCell.Value = "S_OBJID" Then
i6 = Split(ActiveCell.Address(columnAbsolute:=True, ReferenceStyle:=xlR1C1), "C")(1)
ElseIf ActiveCell.Value = "DATO" Then
i7 = Split(ActiveCell.Address(columnAbsolute:=True, ReferenceStyle:=xlR1C1), "C")(1)
Else
End If
i2 = i2 + 1
Loop
MsgBox (i3 & i4 & i5 & i6 & i7)
Sheets("INPUT").Cells(i5, i3).Select
MsgBox (ActiveCell.Value)
End Sub
Thanks a lot for your help!
Dim
statement, any variable that is not followed byas var_type
will be declared as being of typeVariant
. So in your firstDim
line,day_b
,point
andnorth_b
will be of typeDate
,String
andDouble
. All of the other variables in that line will be of typeVariant
. This may not be what you want. – Ron Rosenfeld