Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to sort a table that grows with additional data. The top left value
never changes and is Range("B6") but the bottom right cell will change as the table grows. How do I go about defining the range? -- Bernie |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like:
======== Dim RNG as Range Set RNG = Range("B6", Range("B6").SpecialCells(xlCellTypeLastCell)) RNG.Sort Key1:=Range("B6"), Order1:=xlDescending ======= Does that help you get started? -- "Actually, I *am* a rocket scientist." -- JB (www.MadRocketScientist.com) Your feedback is appreciated, click YES if this post helped you. "brichard429" wrote: I want to sort a table that grows with additional data. The top left value never changes and is Range("B6") but the bottom right cell will change as the table grows. How do I go about defining the range? -- Bernie |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bernie,
Note that a space and underscore at the end of a line is a line break in an otherwise single line of code. Dim rngMyRange As Range 'Edit "Sheet1" to your sheet name With Sheets("Sheet1") 'Edit "E" to your last column of range Set rngMyRange = .Range(.Cells(6, "B"), _ .Cells(.Rows.Count, "E").End(xlUp)) End With -- Regards, OssieMac "brichard429" wrote: I want to sort a table that grows with additional data. The top left value never changes and is Range("B6") but the bottom right cell will change as the table grows. How do I go about defining the range? -- Bernie |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you both for your feedback. After working with your suggestions I came
up with this solution Range(Range("B6"), Range("B6").End(xlDown).End(xlToRight)).Select -- Bernie "brichard429" wrote: I want to sort a table that grows with additional data. The top left value never changes and is Range("B6") but the bottom right cell will change as the table grows. How do I go about defining the range? -- Bernie |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you both for your suggestions, I used them to come up with this:
Range(Range("B6"), Range("B6").End(xlDown).End(xlToRight)).Select which work for me. -- Bernie "brichard429" wrote: I want to sort a table that grows with additional data. The top left value never changes and is Range("B6") but the bottom right cell will change as the table grows. How do I go about defining the range? -- Bernie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Defining a range | Excel Programming | |||
Defining Range Name | Excel Discussion (Misc queries) | |||
Defining series range for named range | Excel Programming | |||
Defining a Range | Excel Programming | |||
Defining a range | Excel Programming |