Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ram Ram is offline
external usenet poster
 
Posts: 138
Default Advancedfilter

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Advancedfilter

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
AdvancedFilter with VBA newToExcel Excel Programming 2 September 30th 05 05:20 PM
AdvancedFilter in VB loopy[_6_] Excel Programming 1 June 22nd 05 03:24 PM
AdvancedFilter to Array Witek[_2_] Excel Programming 0 April 23rd 05 07:19 PM
Help with AdvancedFilter method Sumanth Suri Excel Programming 1 November 21st 03 06:02 AM
AdvancedFilter question Debra Dalgleish[_2_] Excel Programming 0 September 1st 03 12:14 AM


All times are GMT +1. The time now is 01:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"