On my worksheet, Column G is a named range called Provider. In my macro, my goal is to search column G for a provider name and if the value if found, then move the data beside that value to another location. A lot of this macro has been trial and error – mostly error. May I have a clue as to why the below code isn’t working? It stops at IfColG.Value=”a’ Then…with the message “object variable or With Block variable not set”.
Dim ColG As Range
SetColG = Range(“Provider”)
lastrow = Cells(Rows.Count, “A”).End(xlUp).Row
If ColG.Value = “a” Then
Range(“A1:A6”).Copy Cells(2, lastrow)
End If