Duplicate removal rule extension needed

I have the latest version of Excel as shown here http://screencast.com/t/TmhIc9kz.  If a duplicate company name occurs in column A, then the row that contains data in the least number of columns should be removed where the row that contains data in the most number of columns should remain.  Assistance is  greatly appreciated.
frugalmuleAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Cornelia YoderArtistCommented:
This isn't the complete answer, but it might get you started:

http://www.automationanywhere.com/solutions/ST/T32.htm
0
frugalmuleAuthor Commented:
not sure where to go with that one?
0
Martin LissOlder than dirtCommented:
Here's a macro you can try.

Sub RemoveLeastData()
Dim lngLastRow As Long
Dim lngLastCol As Long
Dim lngRow As Long
Dim FoundDupe As Range
Dim intCount As Integer
Dim intDupeCount As Integer

lngLastRow = ActiveSheet.UsedRange.Rows.Count
lngLastCol = Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPrevious).Column

Application.ScreenUpdating = False

For lngRow = lngLastRow - 1 To 2 Step -1
    Range(Cells(lngRow + 1, 1), Cells(lngLastRow, 1)).Select
    With Selection
        Set FoundDupe = .Find(What:=Cells(lngRow, 1), After:=ActiveCell, LookIn:=xlValues, _
                LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
                MatchCase:=False, SearchFormat:=False)
    End With
    If Not FoundDupe Is Nothing Then
        intCount = Application.CountA(Range(Cells(lngRow, 1), Cells(lngRow, lngLastCol)))
        intDupeCount = Application.CountA(Range(Cells(FoundDupe.Row, 1), Cells(FoundDupe.Row, lngLastCol)))
        If intCount < intDupeCount Then
            Cells(lngRow, 1).EntireRow.Delete
        Else
            Cells(FoundDupe.Row, 1).EntireRow.Delete
        End If
    End If
Next

Application.ScreenUpdating = True

End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Martin LissOlder than dirtCommented:
Did that help you?
0
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.