Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Selection
I am trying to sort a range in my worksheet.
I create a worksheet pulling data from other spreadsheets. I go through a directory and advance rows by using x+1. At the the end I don't know how many rows I have and I don't want to hard code it. How do I use a variable in the Range expression. I only know Range("A6:AT255") Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Selection
Range("A6:AT" & x)
0r Range("A6:AT" & x + 1) also Range(cells(6,"A"),cells(x,"AT")) or x + 1 of course. -- Regards, Tom Ogilvy "ibbm" wrote: I am trying to sort a range in my worksheet. I create a worksheet pulling data from other spreadsheets. I go through a directory and advance rows by using x+1. At the the end I don't know how many rows I have and I don't want to hard code it. How do I use a variable in the Range expression. I only know Range("A6:AT255") Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Selection
Can you pick out a column that always has data?
Dim LastRow as long with activesheet lastrow = .cells(.rows.count,"A").end(xlup).row .range("a6:At" & lastrow).sort... end with ibbm wrote: I am trying to sort a range in my worksheet. I create a worksheet pulling data from other spreadsheets. I go through a directory and advance rows by using x+1. At the the end I don't know how many rows I have and I don't want to hard code it. How do I use a variable in the Range expression. I only know Range("A6:AT255") Thanks -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Selection
awesome thanks
"Tom Ogilvy" wrote: Range("A6:AT" & x) 0r Range("A6:AT" & x + 1) also Range(cells(6,"A"),cells(x,"AT")) or x + 1 of course. -- Regards, Tom Ogilvy "ibbm" wrote: I am trying to sort a range in my worksheet. I create a worksheet pulling data from other spreadsheets. I go through a directory and advance rows by using x+1. At the the end I don't know how many rows I have and I don't want to hard code it. How do I use a variable in the Range expression. I only know Range("A6:AT255") Thanks |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Sort Selection
great idea, thanks.
"Dave Peterson" wrote: Can you pick out a column that always has data? Dim LastRow as long with activesheet lastrow = .cells(.rows.count,"A").end(xlup).row .range("a6:At" & lastrow).sort... end with ibbm wrote: I am trying to sort a range in my worksheet. I create a worksheet pulling data from other spreadsheets. I go through a directory and advance rows by using x+1. At the the end I don't know how many rows I have and I don't want to hard code it. How do I use a variable in the Range expression. I only know Range("A6:AT255") Thanks -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I sort a selection of cells into random order? | Excel Discussion (Misc queries) | |||
Selection.Sort error | Excel Programming | |||
Macro - Data Sort -Variable Selection | Excel Discussion (Misc queries) | |||
Selection.Sort not working? | Excel Programming | |||
Need a macro for selection and sort | Excel Programming |