I have a macro where I wants to delete all rows containing a specified number for eg 10. However when running the macro no rows are being deleted
Your asistance in resolving this is most appreciated
Your asistance in resolving this is most appreciated
Code:
Sub Delete_PR_Period()
Sheets("Data").Select
Range("P1").Select
ActiveCell.FormulaR1C1 = InputBox("select prior period to delete for eg 9")
Application.ScreenUpdating = False
Static fx, WS1, Holder, Lr, LrRange, Counter
Set WS1 = Sheets("Data")
WS1.Activate
Holder = WS1.Range("AA1").Value
Lr = WS1.Range("J100000").End(xlUp).Row
LrRange = WS1.Range("J2:J" & Lr).Address(False, False)
Counter = 0
While Counter < 6
Counter = Counter + 1
For Each fx In WS1.Range(LrRange)
If fx.Value > "" Then
If fx.Value = Holder Then
fx.EntireRow.Select
Selection.Delete Shift:=xlUp
End If
End If
Next fx
Wend
End Sub [