Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Defining a range

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default Defining a 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?
--
"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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Defining a range

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Defining a range

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Defining a range

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Defining a range JDBAZ Excel Programming 2 June 29th 08 05:55 PM
Defining Range Name anshu[_2_] Excel Discussion (Misc queries) 2 July 22nd 07 07:30 AM
Defining series range for named range Barb Reinhardt Excel Programming 1 August 3rd 06 09:00 PM
Defining a Range Ric[_5_] Excel Programming 4 April 26th 04 07:34 PM
Defining a range Matt Excel Programming 3 January 23rd 04 03:21 PM


All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"