View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson Jim Thomlinson is offline
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.