Store Data Message Box

Jared_Jones_23

New Member
Joined
Jun 24, 2011
Messages
34
I have a macro that deletes duplicate rows once it is run. I was wondering if there is anyway that instead of immediately deleting the rows it could save the rows and print a message box listing the duplicate rows and then prompt them to delete them with yes or no.
Any suggestions are appreciated.
Thank you,
Jared

Sub rows()
'using nested do while loops
'we start at row 20 because row 19 has only the headers
x = 20
y = x + 1
Do While Cells(x, 1).Value <> ""
Do While Cells(y, 1).Value <> ""
If Cells(x, 1).Value = Cells(y, 1).Value And Cells(x, 2) = Cells(y, 2).Value And Cells(x, 8) = Cells(y, 8) And Cells(x, 12).Value = Cells(y, 12).Value And Cells(x, 14).Value = Cells(y, 14).Value And Cells(x, 15).Value = Cells(y, 15).Value And Cells(x, 16).Value = Cells(y, 16).Value And Cells(x, 18).Value = Cells(y, 18).Value And Cells(x, 20).Value = Cells(y, 20).Value And Cells(x, 21).Value = Cells(y, 21).Value And Cells(x, 22).Value = Cells(y, 22).Value And Cells(x, 23).Value = Cells(y, 23).Value And Cells(x, 24).Value = Cells(y, 24).Value And Cells(x, 25).Value = Cells(y, 25).Value Then

'delete if duplicate
Cells(y, 1).EntireRow.Delete
Else
y = y + 1
End If
Loop
x = x + 1
y = x + 1
Loop
End Sub
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
So just display the row numbers that are duplicated, or specific data from each duplicate row?

Also is there a MAX number of rows it will check, or is it a "growing" list?
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top