Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Return the row numbers or a dynamic range in VBA

Hello, I have finally figured out how to create a dynamic range and it works
great.
Now I need to query this dynamic range to determine the row numbers of the
first and last rows of the range.

Example:

I have a dynamic range named Range_6. Being dynamic in nature, this range
changes frequently. What I need to know is how can I query this "Range_6"
range to retrieve only its beginning row number and ending row number?

If I have a dynamic range that equates to D11:D142 - using VBA, how can I
query Range_6 to get just the 11 and 142 part? I don't need to select the
range "Range(range_6).Select", just return the row numbers?

Hope that makes sense!!

Thanks
Jim


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Return the row numbers or a dynamic range in VBA

Jim,

The first row:
MsgBox Range("Range_6").Row

The last row:
MsgBox Range("Range_6").Cells(Range("Range_6").Cells.Coun t).Row

HTH,
Bernie
MS Excel MVP


"Jim" <. wrote in message ...
Hello, I have finally figured out how to create a dynamic range and it works great.
Now I need to query this dynamic range to determine the row numbers of the first and last rows of
the range.

Example:

I have a dynamic range named Range_6. Being dynamic in nature, this range changes frequently.
What I need to know is how can I query this "Range_6" range to retrieve only its beginning row
number and ending row number?

If I have a dynamic range that equates to D11:D142 - using VBA, how can I query Range_6 to get
just the 11 and 142 part? I don't need to select the range "Range(range_6).Select", just return
the row numbers?

Hope that makes sense!!

Thanks
Jim




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Return the row numbers or a dynamic range in VBA


Set rng = Range("myRange")
FirstRow = rng.Row
lastRow = rng(rng.Count).Row


--
HTH

Bob Phillips

"Jim" <. wrote in message ...
Hello, I have finally figured out how to create a dynamic range and it

works
great.
Now I need to query this dynamic range to determine the row numbers of the
first and last rows of the range.

Example:

I have a dynamic range named Range_6. Being dynamic in nature, this range
changes frequently. What I need to know is how can I query this "Range_6"
range to retrieve only its beginning row number and ending row number?

If I have a dynamic range that equates to D11:D142 - using VBA, how can I
query Range_6 to get just the 11 and 142 part? I don't need to select the
range "Range(range_6).Select", just return the row numbers?

Hope that makes sense!!

Thanks
Jim




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Return the row numbers or a dynamic range in VBA

Outstanding!! Thanks Bob and Bernie, both your suggestions worked GREAT!
This was really busting my chops.

Thanks so much!!!

Jim



"Jim" <. wrote in message ...
Hello, I have finally figured out how to create a dynamic range and it
works great.
Now I need to query this dynamic range to determine the row numbers of the
first and last rows of the range.

Example:

I have a dynamic range named Range_6. Being dynamic in nature, this range
changes frequently. What I need to know is how can I query this "Range_6"
range to retrieve only its beginning row number and ending row number?

If I have a dynamic range that equates to D11:D142 - using VBA, how can I
query Range_6 to get just the 11 and 142 part? I don't need to select the
range "Range(range_6).Select", just return the row numbers?

Hope that makes sense!!

Thanks
Jim




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
Return the 2 lowest numbers within a range mpenkala Excel Worksheet Functions 6 April 17th 08 03:25 AM
addup up a dynamic range of numbers in a column observer Excel Discussion (Misc queries) 1 February 2nd 08 02:31 PM
addup up a dynamic range of numbers in a column observer Excel Worksheet Functions 1 February 2nd 08 02:31 PM
lookup range of numbers; return corresponding data for the fixed r mmpfa07 Excel Worksheet Functions 1 May 2nd 07 07:33 PM
How to return a single value for a range of numbers Tami Excel Worksheet Functions 3 January 13th 06 02:34 AM


All times are GMT +1. The time now is 07:59 AM.

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

About Us

"It's about Microsoft Excel"