Yes no drop down list and macros

L

Larry Fitch

I have an excel sheet that get imported into another workbook by way of a
macro.. This sheet contains two drop down lists.

When I run the macro I get an info box that pops up telling me:

"A formula or sheet you want to move or copy contains the 'YES_NO' which
already exists on the destination worksheet. Do you want to use this version
of the name?"

Can I add any code to the macro to always say yes to this and not see the
dialogue box ??
 
J

Jacob Skaria

Try

Sub Macro()
Application.DisplayAlerts = False

'your code here

Application.DisplayAlerts = True
End Sub

If this post helps click Yes
 
P

Paul C

I did not test but try
Application.DisplayAlerts=false
and then reset after the copy
Application.DisplayAlerts=true

I know this works to suppress the message when deleting sheets
 
L

Larry Fitch

THanks Jacob..

That worked great !!!

If I could ask another question... In the macro below I am able to source
the input sheet I am looking for and then I bascially do a copy and paste
into my workbook -

Sub Statistics_Input()
'
' Statistics_Input Macro
'
' Keyboard Shortcut: Ctrl+q
'
Application.DisplayAlerts = False
Application.ScreenUpdating = False
FOpen = Application.Dialogs(xlDialogOpen).Show(ThisWorkbook.Path)
Range("C10:D88").Select
Selection.Copy
Windows(ThisWorkbook.Name).Activate
Sheets("Statistics").Select
Range("C10:D88").Select
ActiveSheet.Paste
Sheets("Selection Sheet").Select
Application.DisplayAlerts = True

End Sub

I cannot figure out how to close the source document after the cut and
paste..
 
J

Jacob Skaria

Try the below

Dim wb As Workbook
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Application.Dialogs(xlDialogOpen).Show ThisWorkbook.Path
Set wb = ActiveWorkbook
wb.ActiveSheet.Range("C10:D88").Copy _
ThisWorkbook.Sheets("Statistics").Range("C10")
wb.Close False
Application.DisplayAlerts = True
Application.ScreenUpdating = True

If this post helps click Yes
 

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