Macro to delete row based on criteria (first few characters of string)
Syntax wrong
Sub Test()
Dim iLastRow As Long
Dim i As Long
Dim nCalculation
With Application
.ScreenUpdating = False
nCalculation = .Calculation
.Calculation = xlCalculationManual
End With
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 1 Step -1
If Left(Cells(i, "A").Value, 6) = "RPS677" Then
Rows(i).Resize(7).Delete
End If
Next i
With Application
.Calculation = nCalculation
.ScreenUpdating = True
End With
End Sub
--
HTH
Bob Phillips
(remove xxx from email address if mailing direct)
wrote in message
oups.com...
Thanks for the quick response. I am getting a run-time error '424' :
Object required. When I go to debug, it's stopping at the "If
Left(Cells(i, "A"), 6).Value = "RPS677" Then" part of the code.
Any words of advice?
Thanks in advance
|