Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm sure I'm missing something simple.... I seem to be missunderstanding how
to create the range I need. I also may be trying to be too efficient with my use of the range so, maybe I need to consider that. I'm trying to gather unique values from a column of data, and sort it before I put it into another area of the WS. I have a named range "AcctList" RefersTo: $M$30:$M$160 I have a function Last that will find the last row number that has data within the range passed in. So I want to take the Range("AcctList") and create a new range that contains cells from the beginning of "AcctList" to the last row determined by my function Last. I currently have this: Set currRange = ActiveSheet.Range("AcctList") AccountLastRow = Last(1, currRange) If AccountLastRow <= 0 Then Exit Function ' no data in range. Set currRange2 = ActiveSheet.Range(currRange.Cells(1), currRange.Cells(AccountLastRow)) But if AccountLastRow is 31, then the range is $M30:M60. What is the correct way to use that AccountLastRow to specifiy the range? Once I have this range, I already have the Unique and sort functions complete. Thanks, John S. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
sorting range | Excel Discussion (Misc queries) | |||
sorting range | Excel Discussion (Misc queries) | |||
Sorting a Range | Excel Discussion (Misc queries) | |||
sorting a range | Excel Discussion (Misc queries) | |||
Sorting a Range using VBA | Excel Programming |