Row deleting script problem

J

jessica

Hello Guys!
I have made a script for deleting rows where column A value
is greater than 1280.
It works fine but it will loop endlessly. What can I do about it?
If I delete the "RowNumber = RowNumber - 1" then it does'nt
work properly.

TotalRows = Application.CountA(ActiveSheet.Range("A:A"))
Cells(1, 1).Select
For RowNumber = 1 To TotalRows
If Cells(RowNumber, 1).Value > 1280 Then
Cells(RowNumber, 1).Select
Selection.EntireRow.Delete
RowNumber = RowNumber - 1
End If
Next

Please help me,
Little Jessica
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top