copying named cells into new workbook

G

GJR3599

Is it possible to copy and paste named cells from one workbook to another
without having the origin file name pasting in as well? So if i'm pasting a
cell named XYZfrom One.xls into Two.xls will Two.xls have a cell called
One.xls!XYZ ? It is important that the Two.xls workbook have absolutely no
reference to One.xls. Also, how do I keep the message that asks if I want to
keep the cell name from popping up when I'm pasting into Two.xls?
 
T

Tushar Mehta

Did you check the name in Two.xls using Insert | Name > Define...?
What was the name? Was it One.xls!XYZ?

If you are using the GUI, the warning you refer to cannot be
suppressed. If you are using code, use the DisplayAlerts property as
in:

Sub testIt()
Application.DisplayAlerts = False
Workbooks("book1").Worksheets("sheet1").Range("C11:E20").Copy _
Workbooks("Book2").Worksheets("sheet1").Range("C11")
Application.DisplayAlerts = True
End Sub

Book1 Sheet1 C11:C20 was named aName. Running the above code twice
generates the warning *if* the first line is commented out.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top