ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy Worksheet with Named Ranges (https://www.excelbanter.com/excel-programming/412131-copy-worksheet-named-ranges.html)

KC Rippstein hotmail com>

Copy Worksheet with Named Ranges
 
Hello. I am trying to copy a worksheet containing a named range to another
workbook. When I highlight the range in the new workbook, the name dialog
box correctly shows the name of the range, but when I try to Go To that named
range, it's invalid, and when I go to InsertNameDefine the named range
points to =#REF!A2:C29. In my macro, I even tried to name the range in my
new workbook using ActiveWorkbook.Names.Add as well as
Sheets("Codes").Range("A2:C29").Name = "PropertyCodes". Both attempts
failed. Help, please?

Per Jessen[_2_]

Copy Worksheet with Named Ranges
 
On 5 Jun., 19:50, KC Rippstein hotmail com <kcrippstein<atdot wrote:
Hello. *I am trying to copy a worksheet containing a named range to another
workbook. *When I highlight the range in the new workbook, the name dialog
box correctly shows the name of the range, but when I try to Go To that named
range, it's invalid, and when I go to InsertNameDefine the named range
points to =#REF!A2:C29. *In my macro, I even tried to name the range in my
new workbook using ActiveWorkbook.Names.Add as well as
Sheets("Codes").Range("A2:C29").Name = "PropertyCodes". *Both attempts
failed. *Help, please?


Hi

Haven't testet it, but i think you need do delete the names before you
assing them again.

Try this:

ActiveWorkbook.Names("PropertyCodes").Delete

Regards,
Per

KC Rippstein hotmail com>

Copy Worksheet with Named Ranges
 
Thank you so much, that worked perfectly.
--
Please remember to indicate when the post is answered so others can benefit
from it later.


"Per Jessen" wrote:

On 5 Jun., 19:50, KC Rippstein hotmail com <kcrippstein<atdot wrote:
Hello. I am trying to copy a worksheet containing a named range to another
workbook. When I highlight the range in the new workbook, the name dialog
box correctly shows the name of the range, but when I try to Go To that named
range, it's invalid, and when I go to InsertNameDefine the named range
points to =#REF!A2:C29. In my macro, I even tried to name the range in my
new workbook using ActiveWorkbook.Names.Add as well as
Sheets("Codes").Range("A2:C29").Name = "PropertyCodes". Both attempts
failed. Help, please?


Hi

Haven't testet it, but i think you need do delete the names before you
assing them again.

Try this:

ActiveWorkbook.Names("PropertyCodes").Delete

Regards,
Per



All times are GMT +1. The time now is 06:49 AM.

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