Hello,
I am having trouble with the script below and I am not sure what it is not correct.
The script looks for the word "EQ" in column J and then selects the 3 cells in front of the text (cells in column H,I,J) to cut and then paste them in column G. The script is only doing the first one but then I get the Run-time error '1004': Unable to get the FindNext property of the Range class
Could someone please assist shedding light on this issue
Cheers
I am having trouble with the script below and I am not sure what it is not correct.
The script looks for the word "EQ" in column J and then selects the 3 cells in front of the text (cells in column H,I,J) to cut and then paste them in column G. The script is only doing the first one but then I get the Run-time error '1004': Unable to get the FindNext property of the Range class
Could someone please assist shedding light on this issue
Cheers
VBA Code:
Sub FindAndCut()
Dim C As Range
With ActiveSheet.Range("j2:j20000")
Set C = .Find("EQ", LookIn:=xlValues)
If Not C Is Nothing Then
firstAddress = C.Address
Do
Range(C, C.Offset(0, -2)).Select
Selection.Cut Selection.Offset(0, -1)
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address <> firstAddress
End If
End With
End Sub