Named ranges and pasting formulas with named references

D

Dude3966

I have created a workbook that will copy and paste cells from another
workbook into itself using VBA. In the parent workbook is a range of cells
that are named, one of the formulas that is pasted from else where refers to
this named range. The copy/paste function works fine and the formulas work.
the problem that I have is that every time the formual is copied into the
parent work book a message is desplayed that read:

A formula or sheet you want to move containf the name 'ref', which already
exsts in the destination worksheet. Do yuo want to use this version of the
name?
To use the name as defined in the destination sheet, click Yes.
To rename the range reffered to int he formula or worksheet, click No, and
enter a new name in the Name Conflict dialog box.

i would like to be able to automatically choose Yes.

Is this possible and if so how?
 
K

Ken Johnson

I have created a workbook that will copy and paste cells from another
workbook into itself using VBA. In the parent workbook is a range of cells
that are named, one of the formulas that is pasted from else where refersto
this named range. The copy/paste function works fine and the formulas work.
the problem that I have is that every time the formual is copied into the
parent work book a message is desplayed that read:

A formula or sheet you want to move containf the name 'ref', which already
exsts in the destination worksheet. Do yuo want to use this version of the
name?
To use the name as defined in the destination sheet, click Yes.
To rename the range reffered to int he formula or worksheet, click No, and
enter a new name in the Name Conflict dialog box.

i would like to be able to automatically choose Yes.

Is this possible and if so how?

Try...

Application.DisplayAlerts = False

before the paste.

Ken Johnson
 
D

Dude3966

Ken,

Thanks very much, that answers my question. It works exactly as i wanted.

Chris
 

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