|
-
Jul 17th, 2006, 03:13 PM
#1
Thread Starter
Member
[RESOLVED] Simple duplicate eliminating script
Hey all, kinda new to the whole vba thing.
I'm trying to do something fairly simple: I have a couple hundred lines of data in a spreadsheet, and there are duplicates from when i complied all the data together. I've sorted the list alpha by company name. I'm trying to write a simple script that checks column B (the name of the company) against the following row to see if it's a duplicate; if it is delete the entire row, and then recheck (because there can be 3-4 duplicate entries), if it's not a duplicate move onto the next row.
Thanks a bunch guys, i'm just having trouble finding a good resource for vba online.
Last edited by heinz1218; Jul 17th, 2006 at 03:49 PM.
Reason: resolved
-
Jul 17th, 2006, 03:23 PM
#2
Re: Simple duplicate eliminating script
how about this:
VB Code:
Private Sub RemDups()
Dim ROW As Integer
ROW = 1
Do Until Range("B" & ROW) = ""
Range("B" & ROW).Select
If Range("B" & ROW) = Range("B" & ROW + 1) Then
Rows(ROW & ":" & ROW).Delete Shift:=xlUp
Else
ROW = ROW + 1
End If
Loop
End Sub
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jul 17th, 2006, 03:49 PM
#3
Thread Starter
Member
Re: Simple duplicate eliminating script
Thanks a bunch, Static, that worked great. Just out of curiousity, why'd you make it a Private? I couldn't see it in my macro list until i removed the private attribute.
Thanks again
Last edited by heinz1218; Jul 17th, 2006 at 04:09 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|