Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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" But there is something wrong with the syntax because that isn't correct either. Any suggestions or ideas would be appreciated. Thanks for the help........ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Worksheets("AR List").Range("A7:A" & lstrow).Name = "Range"
-- HTH RP (remove nothere from the email address if mailing direct) "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" But there is something wrong with the syntax because that isn't correct either. Any suggestions or ideas would be appreciated. Thanks for the help........ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I enter formula sum(range+range)*0.15 sumif(range=3) | Excel Discussion (Misc queries) | |||
Cond. Format Data Bars of range based on values of another range | Excel Worksheet Functions | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
Range.Find returns cell outside of range when range set to single cell | Excel Programming | |||
how to? set my range= my UDF argument (range vs. value in range) [advanced?] | Excel Programming |