View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
davegb davegb is offline
external usenet poster
 
Posts: 573
Default Invalid qualifer

Thanks!
Now I'm getting an "argument not Optional" on
Sh.Range.AdvancedFilter...
I suspect that even though I selected the range, XL doesn't know which
one I want to filter. And there is no "selection" option for a range
object. So how do I tell it I want it to filter on the currently
selected range? I want to avoid using named ranges because they have to
apply across all worksheets and I need to filter this range on many
different worksheets, don't want to have to create unique range names
on each sheet if I can avoid it.

Sub ShowAll()
Dim MacRec As Object
Dim Sh As Worksheet

Set MacRec = ActiveWorkbook.Sheets("Macro Records")


For Each Sh In ActiveWorkbook.Worksheets
Range("B3").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight).Offset(0, 2)).Select
Sh.Range.AdvancedFilter Action:=xlFilterInPlace, _
CriteriaRange:=MacRec.Range("S5:Z6"), Unique:=False
Range("a1").Select
Next Sh
End Sub

Any ideas?


davegb wrote:
This code gives me an invalid qualifier error:

Range("B4").Select

Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight.Offset(0, 2))).Select

I want to select a range starting at B4, ending at the bottom of column
B, going to the right until the data ends, and then adding 2 more
columns to the range. Can someone point me in the right direction?
Thanks!