View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
DAB DAB is offline
external usenet poster
 
Posts: 14
Default Need Help filtering data

Hello Ryan
This one works like a charm.
I will see if I can make the other one to work, most likely I did something
wrong when I tried it.
Thanks again
Daniel

"ryguy7272" wrote:

Try this macro:
Sub DeleteDuplicateRows()
'
' This macro deletes duplicate rows in the selection. Duplicates are
' counted in the COLUMN of the active cell.

Dim Col As Integer
Dim r As Long
Dim c As Range
Dim n As Long
Dim v As Variant
Dim rng As Range

On Error GoTo EndMacro
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Col = ActiveCell.Column

If Selection.Rows.count 1 Then
Set rng = Selection
Else
Set rng = ActiveSheet.UsedRange.Rows
End If

n = 0
For r = rng.Rows.count To 1 Step -1
v = rng.Cells(r, 1).Value
If Application.WorksheetFunction.CountIf(rng.Columns( 1), v) 1 Then
rng.Rows(r).EntireRow.Delete
n = n + 1
End If
Next r

EndMacro:

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub

Regards,
Ryan---

--
RyGuy


"dab" wrote:

Hello and thanks for your time reading this post.
If this question has been answered before I will be glad to look at it but
so far I could not find it.
I dont know how to program in Excel so I was wondering if there is a command
or formula that will do this:
I have a list of numbers like
A B C
1 135 200 351
2 135 200 351
3 500 179 165
4 500 179 165
5 702 205 140
6 702 205 140
And after the formula or function the result I need is:
A B C
1 135 200 351
2 500 179 165
3 702 205 140
So basically, it will remove any extra line containing the same values and
return only one.
Thanks in advance for your help.
Best regards