Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have data being pasted into a worksheet from which I need to do a unique
sort on the first column (EmployeeID) and copy the results to another worksheet. My problem is with referencing the range address. Since the number of rows can vary, what is the proper way to get that full range into the source line. So far I have this: Dim SourceArea, TargetArea as Variant Set TargetArea = Application.Sheets("Current").Range("A5") Application.Sheets("Working").Activate Range("A2").Select Range(Selection, Selection.End(xlDown)).Select '<-Gets all rows Set SourceArea = ActiveCell.Address Range([SourceArea]).AdvancedFilter Action:=xlFilterCopy, _ CopyToRange:=Range([TargetArea]), Unique:=True If Excel has a better way to reference a range, please let me know. My first instinct is to assign it to a variable. As always thanks for the help. -- Michael Conroy Stamford, CT |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Assign range to variable for sort | Excel Programming | |||
Sort by a Variable Range | Excel Programming | |||
Macro to Sort A-Z a variable range of cells | Excel Discussion (Misc queries) | |||
VBA Variable Range Sort | Excel Discussion (Misc queries) | |||
Sort variable range in descending order | Excel Programming |