Thread: Range Name
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
PaulD PaulD is offline
external usenet poster
 
Posts: 92
Default Range Name

"JT" wrote in message
...
: I have the following code in my macro:
:
: ActiveWorkbook.Names.Add Name:="Range", RefersToR1C1:= _
: "='Sheet1'!R7C1:R125C1"
:
: The problem is the last row of the range will change each
: time I run the macro. I have tried finding the last row
: of the range and using a variable like this:
:
: ActiveWorkbook.Names.Add Name:="Range", RefersToR1C1:= _
: "='AR List'!R7C1:R(lstrow)C1"
<snip

you can't put a variable in the middle of a string.
"='AR List'!R7C1:R" & lstrow & "C1"

Paul D