Defining a range

  • Thread starter Thread starter brichard429
  • Start date Start date
B

brichard429

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?
 
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?
 
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
 
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
 
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.
 
Back
Top