Macro to Deleting Multiple Rows [Solved/Closed]

Report
Posts
16
Registration date
Tuesday March 23, 2010
Status
Member
Last seen
March 29, 2013
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
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 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
760
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