ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding range name that includes a sheet name (https://www.excelbanter.com/excel-programming/378591-re-adding-range-name-includes-sheet-name.html)

Jim Cone

adding range name that includes a sheet name
 
Try... RefersTo:="=" & strRangeAddress
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"KarenH"
wrote in message
I am attempting to add ranges to a sheet based on another spreadsheet.

I have named the range name strRangeName, and the corresponding range
address as strRangeAddress. However, the range addresses will include
worksheet names as well as ranges, for example: 'S-S-0'!$B$12:$D$63

The following statement in my code is failing:
ActiveWorkbook.Sheets(strSheetName).Names.Add Name:=strRangeName,
RefersTo:=strRangeAddress
I'm fairly certain it's due to the range name, but I"m not sure of a way
around it.
Any ideas? Thanks in advance



All times are GMT +1. The time now is 12:11 PM.

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