Microsoft Excel Popup Box automatically having it select yes

zoog25

Active Member
Joined
Nov 21, 2011
Messages
394
Hello All,

Here is my situation. I have a program that I'm working on that transfers sheets from one workbook to another. Now every time it runs I get a popup message asking the following:
A formula or sheet you want to move or copay contains the name "TBDeveloper", which already exists on the destination worksheet. Do you want to use this version of the name?
-To use the name as defined in the destination sheet, 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.

Now the thing is that i don't want to message box to popup because the answer will always be "Yes". How do i prevent / have the program automatically answer yes to this question.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,776
Hi zoog25. Trial moving the sheet using a collection. Something like this...
Code:
Dim FSO As Object, FilDir As Object, ShtCollect As Collection
Set FSO = CreateObject("Scripting.FilesystemObject")
'***adjust file path to suit
Set FilDir = FSO.getfile("C:\yourfoldername\filename.xlsm")
Application.DisplayAlerts = False
Workbooks.Open Filename:=FilDir
'load sheet in collection
Set ShtCollect = New Collection
ShtCollect.Add Workbooks(FilDir.Name).Sheets("Sheet1")
ShtCollect(1).Copy ThisWorkbook.Sheets(1)
Adjust the file path and sheet name to suit. HTH. Dave
 

Watch MrExcel Video

Forum statistics

Threads
1,129,498
Messages
5,636,665
Members
416,935
Latest member
Atulcp

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
Top