M
Michael Conroy
I am trying to do a unique sort to another location and I recorded this code.
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A2:A69").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"AA1"), Unique:=True
The next time there might be more than sixty-seven rows of data, so I did
this, which does not work.
Dim TargetArea as Range
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Set TargetArea = Selection.ActiveCell
Range([TargetArea]).... the rest of the sort code
How does one grab a range of cells, assign it to a variable, and refer to it
further down in the code? If this is not the proper way to do it, please feel
free to let me know. And thanks in advance for any help on this.
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A2:A69").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"AA1"), Unique:=True
The next time there might be more than sixty-seven rows of data, so I did
this, which does not work.
Dim TargetArea as Range
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
Set TargetArea = Selection.ActiveCell
Range([TargetArea]).... the rest of the sort code
How does one grab a range of cells, assign it to a variable, and refer to it
further down in the code? If this is not the proper way to do it, please feel
free to let me know. And thanks in advance for any help on this.