Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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.Works heetFunction.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" wrote in message ... 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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
AdvancedFilter with VBA | Excel Programming | |||
AdvancedFilter in VB | Excel Programming | |||
AdvancedFilter to Array | Excel Programming | |||
Help with AdvancedFilter method | Excel Programming | |||
AdvancedFilter question | Excel Programming |