VBA: Turn off Warning Message

Apple1

Board Regular
Joined
Jan 18, 2015
Messages
121
Using Excel 2010.

I ran a macro to copy worksheets from 1 workbook to another.

But I keep getting the below messages:

Message 1:
"A formula or sheet you want to move or copy contains the name "...", which already exists on the destination worksheet."

Message 2:
"A formula or sheet you want to move or copy contains the name IDX which conflicts with a valid range reference,.... and must be modified

Do you want to use this version of the name?
- To use the name IDX, click Yes.
- To rename the range referred to in the formula or worksheet, click No, and enter a new name in the Name Conflict dialog box."


I inserted the following code to switch off the messages but it doesn't work. What can I do?
Thank you

'Application.DisplayAlerts = False 'Turn off error messages
'Application.Calculation = xlManual
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Application.DisplayAlerts = False stops the warnings to show up.
What you get in your case are errors...which are different from warning.

You need to add checks like if sheet of following name exists in destination.
If so, the delete that sheet first and then copy this one.

 
Upvote 0

Forum statistics

Threads
1,215,330
Messages
6,124,308
Members
449,151
Latest member
JOOJ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top