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 <Ossie...@discussions.microsoft.com>
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 inan
> 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 wayof
> 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