Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Variable length named ranges

I need a way to specify a variable for the last row in a named range.

A static definition looks like this:
ThisWorkbook.Names.Add Name:="dAge", RefersTo:="=RawData!$H$2:$H$100",
Visible:=True

I would like to replace €œ100€ with €œnRows€ and need help with the syntax.


Thank you.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Variable length named ranges

I assume that nRows is an integer or long variable...

ThisWorkbook.Names.Add Name:="dAge", RefersTo:="=RawData!$H$2:$H$" & nRows,
Visible:=True

--
HTH...

Jim Thomlinson


"adimar" wrote:

I need a way to specify a variable for the last row in a named range.

A static definition looks like this:
ThisWorkbook.Names.Add Name:="dAge", RefersTo:="=RawData!$H$2:$H$100",
Visible:=True

I would like to replace €œ100€ with €œnRows€ and need help with the syntax.


Thank you.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Variable length named ranges

"Jim Thomlinson" wrote in message
...

I assume that nRows is an integer or long variable...

ThisWorkbook.Names.Add Name:="dAge", RefersTo:="=RawData!$H$2:$H$" &
nRows,
Visible:=True


I hope the poster understands that the named range is not "connected" to
nRows, i.e., if the value of nRows changes later it won't change the range
that was just created. Just thought I'd mention it....


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Variable length named ranges

In addition to other replies do you really mean to add the name to
"ThisWorkbook". From what you followed up with in your other recent I
suspect you mean ActiveWorkbook or some other named wb.

Regards,
Peter T

"adimar" wrote in message
...
I need a way to specify a variable for the last row in a named range.

A static definition looks like this:
ThisWorkbook.Names.Add Name:="dAge", RefersTo:="=RawData!$H$2:$H$100",
Visible:=True

I would like to replace "100" with "nRows" and need help with the syntax.


Thank you.



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
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Excel Programming 3 December 24th 07 01:15 PM
Counting variable ranges and auto-summing variable ranges Father Guido[_5_] Excel Programming 2 March 29th 06 04:07 AM
Counting Variable Length of Rows in a Named Range jandre[_2_] Excel Programming 0 October 28th 04 06:26 PM
Counting Variable Length of Rows in a Named Range jandre[_3_] Excel Programming 0 October 28th 04 06:24 PM
Counting Variable Length of Rows in a Named Range jandre Excel Programming 1 October 28th 04 05:27 PM


All times are GMT +1. The time now is 01:29 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"