I'm creating a macro in excel. One of the tasks of the macro is to replace the value in a cell, until it reaches a cell with a certain value. I keep getting this message however: "Run-time error '1004' : Method 'Range' of object'_Global' failed"
' Select cell A22, *first line of data*.
Range("A22").Select
If Range("B4") = "802" Then
' Set Do loop to stop when an empty cell is reached.
Dim einde2 As String
einde2 = Range(ActiveCell).Value
Do Until einde2 = "ABC"
Range(ActiveCell.Address) = "XYZ"
einde2 = Range(ActiveCell).Value
Loop
End If
It is probably a very basic mistake, but for a novice like me any help is much appreciated.
Window to my world
' Select cell A22, *first line of data*.
Range("A22").Select
If Range("B4") = "802" Then
' Set Do loop to stop when an empty cell is reached.
Dim einde2 As String
einde2 = Range(ActiveCell).Value
Do Until einde2 = "ABC"
Range(ActiveCell.Address) = "XYZ"
einde2 = Range(ActiveCell).Value
Loop
End If
It is probably a very basic mistake, but for a novice like me any help is much appreciated.
Murphy's Law said:Anything that can go wrong will go wrong
Window to my world