M
Michael Conroy
I trying to program an advanced filter in VBA and copy the unique results to
another location. I recorded the code below to get the basics. However, I run
into a problem when the source information changes size. In the example below
the source range is row 6-14 because that is what the macro recorded for this
instance. Given that the first row remains fixed, how can I get the address
for the last row into the code so that it works no matter how many rows of
information there are? And while I am at it, the target range is on another
worksheet, so could you help me out with the syntax for that as well. And,
since I can't post questions from work, is it possible to select a range and
assign it to a variable like [Source] and [Target] and put those into the
filter code.
Range("C6").Select
Range(Selection, Selection.End(xlDown)).Select
Range("C6:C14").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"E6"), Unique:=True
As always, any help would be greatly appreciated
another location. I recorded the code below to get the basics. However, I run
into a problem when the source information changes size. In the example below
the source range is row 6-14 because that is what the macro recorded for this
instance. Given that the first row remains fixed, how can I get the address
for the last row into the code so that it works no matter how many rows of
information there are? And while I am at it, the target range is on another
worksheet, so could you help me out with the syntax for that as well. And,
since I can't post questions from work, is it possible to select a range and
assign it to a variable like [Source] and [Target] and put those into the
filter code.
Range("C6").Select
Range(Selection, Selection.End(xlDown)).Select
Range("C6:C14").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"E6"), Unique:=True
As always, any help would be greatly appreciated