Macro to Deleting Multiple Rows

Solved/Closed
froggy6703 Posts 16 Registration date Tuesday March 23, 2010 Status Member Last seen March 29, 2013 - Mar 23, 2010 at 09:54 PM
rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 - Mar 24, 2010 at 06:40 AM
Hello, I am running a simple formula in excel to sort out duplicates from a given row, by adding the value "DUP" in a new column on the spreadsheet. Once that is done I run the following macro to delete all the rows that have the value "DUP". The problem I am having is that the macro runs on a loop so every line of the spreadsheet has to be looked at. Wondering if anyone has a macro that I could run that wont run on a loop. The spreadsheet that I am working with has between 5000 - 10000 lines so this is taking alot of time to complete.

Dim intRow
Dim intLastRow
intLastRow = Range("F65536").End(xlUp).Row
For intRow = intLastRow To 1 Step -1
Rows(intRow).Select
If Cells(intRow, 5) = "DUP" Then
Cells(intRow, 5).Select
Selection.EntireRow.Delete
End If
Next intRow

Thank you in advance for your help,

Matt

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Mar 24, 2010 at 06:40 AM
Record your action

1. Apply filers
2. Filter on word DUP
3. Delete all rows

This should give you macro to delete all rows that had word dup
0