Hi -
I am trying to create a macro for a loop that finds partial words in a cell then cuts and relocates the row to another worksheet. I am stumped. I want to find the word "Premium" or the word "Special" in column D. (Starting at D3). Here is what I have that does not work and I am stuck.
I am trying to create a macro for a loop that finds partial words in a cell then cuts and relocates the row to another worksheet. I am stumped. I want to find the word "Premium" or the word "Special" in column D. (Starting at D3). Here is what I have that does not work and I am stuck.
Code:
Sub Move_Data()
Dim i As Long, LastRow As Long, mydata As String, cutrow As Long
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).row
Application.ScreenUpdating = True
For i = LastRow To 2 Step -1
mydata = Cells(i, “D”)
If mydata = Range("D3:D5000").Find("Premium", Range("D3"), xlValues, xlWhole, xlByColumns, xlNext).row Then
Cells(i, “D”).EntireRow.Cut
cutrow = Worksheets("DataSpecialPrem").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).row
ActiveSheet.Paste Destination:=Worksheets(“DataSpecialPrem”).Rows(cutrow)
End If
Next i
End Sub
Last edited by a moderator: