Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofilter (in a macro) problem
I'm using the autofilter feature from a macro
(see below). One last issue, when I run this AutoFilter macro, it keeps putting the first unique ID (607) found (from column A) into my new ID List twice. It only does it for the first item. ID List 607 607 614 615 616 Public Sub ExtractUniqueAndSort(Sheet As String, last_row_used_local As Integer) Dim destcell As String destrow = 4 destcell = Sheets(Sheet).Cells(destrow, ID_List).Address With Sheets(Sheet) 'extract unique IDs from column A Range("A2:A" & last_row_used_local).AdvancedFilter Action:=xlFilterCopy, _ CopyToRange:=Sheets(Sheet).Cells(destrow, ID_List), Unique:=True 'sort the unique IDs .Range(.Range(destcell), .Range(destcell).End(xlDown)) _ .Sort Key1:=.Range(destcell), Order1:=xlAscending, Header:=xlYes End With End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofilter (in a macro) problem
See your other thread.
BrianR wrote: I'm using the autofilter feature from a macro (see below). One last issue, when I run this AutoFilter macro, it keeps putting the first unique ID (607) found (from column A) into my new ID List twice. It only does it for the first item. ID List 607 607 614 615 616 Public Sub ExtractUniqueAndSort(Sheet As String, last_row_used_local As Integer) Dim destcell As String destrow = 4 destcell = Sheets(Sheet).Cells(destrow, ID_List).Address With Sheets(Sheet) 'extract unique IDs from column A Range("A2:A" & last_row_used_local).AdvancedFilter Action:=xlFilterCopy, _ CopyToRange:=Sheets(Sheet).Cells(destrow, ID_List), Unique:=True 'sort the unique IDs .Range(.Range(destcell), .Range(destcell).End(xlDown)) _ .Sort Key1:=.Range(destcell), Order1:=xlAscending, Header:=xlYes End With End Sub -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
autofilter problem | Excel Discussion (Misc queries) | |||
Problem with Autofilter | Excel Discussion (Misc queries) | |||
Autofilter problem | Excel Programming | |||
autofilter problem | Excel Worksheet Functions | |||
Now problem with autofilter | Excel Programming |