I need some help fixing my errors. I am trying to automate a repetitive daily task.
At present, a vlookup is used in column J to return values from another sheet, then column J is used as the basis for further actions to be done.
For example, some rows are deleted based on the text shown in column J, and some cells in column I have the corresponding value in Column J pasted into them.
I want to perform both these tasks using a macro.
If it makes a difference - the values in column J are always vlookup formula results, rather than the text values which are shown in the sample file.
Sub del()
Dim lrow As Long
Dim xrow As Long
Dim i As Long
Dim y As Long
' Here I am trying to delete any row where column J has a text string starting with "Delete row -"
lrow = Cells(Rows.Count, "J").End(xlUp).Row
For xrow = lrow To 3 Step -1
If Range("J" & xrow).Value = "Delete row-*" Then Rows(xrow).Delete
Next xrow
' Here I am trying to copy and paste from column J to column I , whenever the value in column J is between "CWA000000" To "CWA999999"
y = Cells(Rows.Count, "J").End(xlUp).Row
For i = 2 To y
Select Case Cells(i, 1).Value
Case "CWA000000" To "CWA999999"
Range("I1").Value = Range("J1").Value
Case Else
End Select
Next i
End Sub
Thanks for your help
Bookmarks