![]() |
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 |
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 |
All times are GMT +1. The time now is 01:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com