Thread: Sort Selection
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 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