When i try and use advance filter in my code it will only filter if I
activate the worksheet first.
Is there away to use advance filter with out activating the worksheet.
thanks for any help.
When i try and use advance filter in my code it will only filter if I
activate the worksheet first.
Is there away to use advance filter with out activating the worksheet.
thanks for any help.
ram
i'm not sure what your stuff looks like, but below is a snip i wrote earlier
today that works. DATA and LIST are worksheet codenames.
the purists will slam me for sloppy code - but it was a quick fix and it
will give you the idea.
perhaps the solution is to make sure you identify the range you want to
filter.
rgds - voodooJoe
Private Sub Macro4()
'set and advance filter selected range for unique values
Set d =
DATA.Range("I1").Resize(rowsize:=Application.WorksheetFunction.CountA(DATA.Columns(1).EntireColumn))
d.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
'clear the target area
LIST.Range("a1").CurrentRegion.Offset(1, 0).ClearContents
'paste unique values to target area
d.Copy
LIST.Range("a1").PasteSpecial (xlPasteValues)
'turn off filter and copy mode
Application.CutCopyMode = False
d.Parent.ShowAllData
'sort the new list
With LIST.Cells(1, 1)
.CurrentRegion.Sort Key1:=.Cells(2, 1), Order1:=xlAscending,
Header:=xlYes, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom,
DataOption1:=xlSortNormal
End With
End Sub
"ram" <ram@discussions.microsoft.com> wrote in message
news:098F1916-CDF3-4313-9EAD-FAE98DF77FB5@microsoft.com...
> When i try and use advance filter in my code it will only filter if I
> activate the worksheet first.
> Is there away to use advance filter with out activating the worksheet.
>
> thanks for any help.
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks