LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default AdvancedFilter and setting the range

Thanks, Ossie :)

everything is OK now. Didn't know that AdvancedFilter needed a header
row.
I also tried the syntax "With Worksheets..." but omitted the dot
before "Cells".

Learned my lesson :)

Cheers,
Nash
On Mar 23, 4:58*am, OssieMac
wrote:
Hi again Nash,

Just an after thought.

A little added lesson in Excel. The reason that your code did not work when
the referenced sheet was not the active sheet is because Excel thinks that
Cells(.... belongs to the active sheet and the range reference is another
sheet.

The following code should work just as well as the previous code that I
posted. Each Cells function is preceded with the worksheet identifier.

(Note that a space and underscore at the end of a line is a line break in an
otherwise single line of code.)

Set rfilt = Worksheets("fx").Range(Worksheets("fx").Cells(2, 1), _
* * Worksheets("fx").Cells(counter, 1))

In the following code using With / End With, note the dot in front of Range
and Cells. This ties them to Worksheets("fx") and is just a shorthand way of
writing it so you do not have to prefix all the functions with the worksheet
name:-

With Worksheets("fx")
* * Set rfilt = .Range(.Cells(2, 1), .Cells(counter, 1))
End With

Regards,

OssieMac


 
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
Using AdvancedFilter on range of data Connie Excel Discussion (Misc queries) 2 October 19th 06 08:57 PM
Using AdvancedFilter on range of data Connie Excel Programming 0 October 19th 06 04:20 PM
Setting a criteria in an AdvancedFilter macro Wendell A. Clark Excel Programming 3 May 11th 06 04:17 PM
Advancedfilter copy in place doesn't use criteria range correctly Josh[_13_] Excel Programming 1 December 9th 05 02:30 PM
setting range().hidden=True causes range error 1004 STEVE BELL Excel Programming 6 September 2nd 05 02:16 AM


All times are GMT +1. The time now is 03:59 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"