![]() |
|
#26
|
|||
|
|||
|
A B C
FACILITY ZIP CODE STATE AAAAAAA 111111 ?? ROW 7 BBBBBB 22222 ?? ROW 8 CCCCCC 333333 KY ROW 9 EEEEE 555555 MI ROW 10 DDDDDD 444444 AK ROW 11 Sub Remove_Dupes() 'ActiveSheet.Unprotect ' Remove_Dupes Macro Dim lr As Long, r As Long, wr As Long Application.ScreenUpdating = False 'row to write to wr = Sheets("dupesheet").Cells(Rows.Count, 1).End(xlUp).Row + 1 'rows to check for dupes With Sheets("FACILITY RECORDS") 'last row lr = .Cells(Rows.Count, "A").End(xlUp).Row 'start at bottom row and work up For r = lr To 2 Step -1 If .Cells(r, 1) = .Cells(r - 1, 1) Then 'compare the two rows ' credit Tim Williams ~~~ with great explanation at ' http://stackoverflow.com/questions/1...ows-in-a-sheet If Join(Application.Transpose(Application.Transpose(. Cells(r, 1).EntireRow.Value)), "") = _ Join(Application.Transpose(Application.Transpose(. Cells(r - 1, 1).EntireRow.Value)), "") Then 'copy and delete if equal .Cells(r, 1).EntireRow.Copy Sheets("dupesheet").Cells(wr, 1) .Cells(r, 1).EntireRow.Delete wr = wr + 1 End If End If Next r End With Application.ScreenUpdating = True ActiveSheet.Protect ' End Sub I get the error even with this small sample. Wondering if my excel software is wacked out |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pivot not showing number format with commas | olybobo | Excel | 1 | 05-05-2016 05:09 PM |
Counting Blanks in 1 Column and Non-Blanks in Another
|
dogwood705 | Excel | 4 | 02-07-2015 08:45 AM |
| Commas within fields in .csv files | gar | Excel | 1 | 01-29-2015 09:24 PM |
How to use mid or left functions to seperate city,st,zip with no commas
|
sinaranje | Excel | 4 | 11-11-2014 10:52 PM |
No inverted commas in word 2013.
|
tonycrossley | Word | 3 | 01-27-2014 04:55 PM |