D
davegb
I'm trying to apply an advanced filter to a named range called
"FilterRange" on the source worksheet (RecSht).
RecSht.Select
Range("a1").Select
'Selection.CurrentRegion.Select
Set FilterRange = Selection.CurrentRegion
CtyExtr.Select
RecSht.Range(FilterRange).AdvancedFilter Action:= _
xlFilterCopy, CriteriaRange:=RecSht.Range("aa1:aa2"), _
CopyToRange:=Range("A5"), Unique:=False
I tried using a named range, but it seems that macros don't recognize a
named range, at least I can't get it to. So I created a variable to
represent the current region from cell A1, called FilterRange. The
macro doesn't like that either! No matter what different variations of
syntax I use, the macro won't accept it. Right now I'm getting the
"Application defined or object defined error". FilterRange is dimmed as
an object. Any ideas?
Thanks for the help!
"FilterRange" on the source worksheet (RecSht).
RecSht.Select
Range("a1").Select
'Selection.CurrentRegion.Select
Set FilterRange = Selection.CurrentRegion
CtyExtr.Select
RecSht.Range(FilterRange).AdvancedFilter Action:= _
xlFilterCopy, CriteriaRange:=RecSht.Range("aa1:aa2"), _
CopyToRange:=Range("A5"), Unique:=False
I tried using a named range, but it seems that macros don't recognize a
named range, at least I can't get it to. So I created a variable to
represent the current region from cell A1, called FilterRange. The
macro doesn't like that either! No matter what different variations of
syntax I use, the macro won't accept it. Right now I'm getting the
"Application defined or object defined error". FilterRange is dimmed as
an object. Any ideas?
Thanks for the help!