Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
scan for repeating values and then delete
I would like to loop through Column B, and if I find the same repeating
value, then I would like to delete the rows and keep only one. I would always have 4 replicates, but would only like to keep one. For ex., Loop through Column B, and if found "A2" multiple times, then delete 3 out of the 4 rows. The values would vary. I do not want to sort Column B first though. I have the following so far, and don't know how to check to see if the values are repeating. For lRow = Range(Cells(1, 2), Cells(Cells.Rows.Count, 2).End(xlUp)).Rows.Count To 1 Step -1 ...... Next Thank you! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
scan for repeating values and then delete
You don't have to use loops. Just use the advance filter
and check unique records only. See below... ------------------------------------ Sub FilterUnique() Range("B:B").AdvancedFilter Action:=xlFilterCopy, _ CopyToRange:=Range("C1"), Unique:=True End Sub ------------------------------------ Hope this helps... Chong Moua -----Original Message----- I would like to loop through Column B, and if I find the same repeating value, then I would like to delete the rows and keep only one. I would always have 4 replicates, but would only like to keep one. For ex., Loop through Column B, and if found "A2" multiple times, then delete 3 out of the 4 rows. The values would vary. I do not want to sort Column B first though. I have the following so far, and don't know how to check to see if the values are repeating. For lRow = Range(Cells(1, 2), Cells(Cells.Rows.Count, 2).End(xlUp)).Rows.Count To 1 Step -1 ...... Next Thank you! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I delete a portion of cell contents repeating in multiple fie. | Excel Discussion (Misc queries) | |||
repeating values | Excel Worksheet Functions | |||
repeating values | Excel Worksheet Functions | |||
Delete Repeating text in cells | Excel Discussion (Misc queries) | |||
delete repeating rows | Excel Worksheet Functions |