I am trying to get a macro to cut and paste certain rows from sheet ASR to sheet LS, whenever column I is equal to LS.
Sub MoveLS()
Dim i As Variant
Dim endrow As Integer
endrow = Sheets("ASR").Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To endrow
If Cells(i, "I").Value = "LS" Then
Cells(i, "I").EntireRow.Cut Destination:=Sheets("LS").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next
End Sub
I have been staring at different variations of this code on and off for the past 8 hours and cannot figure out what isn't working. Any tips are appreciated!
It is because you haven't declared your sheets. Try the following code: