ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   name of range from macro (https://www.excelbanter.com/excel-programming/342171-name-range-macro.html)

Miroslav

name of range from macro
 
I have command:
ActiveWorkbook.Names.Add Name:="myName", RefersToR1C1:="='mySheet'!R2C1:R20C8"
but the row 20 is changeable. How could I modify the command?
Thanks.

Norman Jones

name of range from macro
 
Hi Miroslav,

Try:

Sub Tester()
Dim rw As Long

rw = 20

ActiveWorkbook.Names.Add Name:="myName", _
RefersToR1C1:="='mySheet'!R2C1:R" & rw & "C8"
End Sub


---
Regards,
Norman



"Miroslav" wrote in message
...
I have command:
ActiveWorkbook.Names.Add Name:="myName",
RefersToR1C1:="='mySheet'!R2C1:R20C8"
but the row 20 is changeable. How could I modify the command?
Thanks.




Miroslav

name of range from macro
 
Hi Norman,
thank you very much an advise. It works.
Regards,
Miroslav

€žNorman Jones" napÃ*sal (napÃ*sala):

Hi Miroslav,

Try:

Sub Tester()
Dim rw As Long

rw = 20

ActiveWorkbook.Names.Add Name:="myName", _
RefersToR1C1:="='mySheet'!R2C1:R" & rw & "C8"
End Sub


---
Regards,
Norman



"Miroslav" wrote in message
...
I have command:
ActiveWorkbook.Names.Add Name:="myName",
RefersToR1C1:="='mySheet'!R2C1:R20C8"
but the row 20 is changeable. How could I modify the command?
Thanks.






All times are GMT +1. The time now is 06:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com