PC Review


Reply
Thread Tools Rate Thread

Defining a range

 
 
brichard429
Guest
Posts: n/a
 
      17th Nov 2009
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 With Quote
 
 
 
 
JBeaucaire
Guest
Posts: n/a
 
      17th Nov 2009
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

 
Reply With Quote
 
OssieMac
Guest
Posts: n/a
 
      17th Nov 2009
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

 
Reply With Quote
 
brichard429
Guest
Posts: n/a
 
      17th Nov 2009
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

 
Reply With Quote
 
brichard429
Guest
Posts: n/a
 
      18th Nov 2009
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining a range as a subset of cells in another range Jay Microsoft Excel Programming 12 23rd Dec 2009 06:38 PM
defining a range dhgerstman@gmail.com Microsoft Excel Programming 2 18th Mar 2008 03:14 PM
Defining series range for named range =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Programming 1 3rd Aug 2006 09:00 PM
Defining a Range =?Utf-8?B?S2F2YWw=?= Microsoft Excel Programming 2 5th Sep 2004 11:53 PM
Defining a Range Ric Microsoft Excel Programming 4 26th Apr 2004 07:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:04 PM.