问题
I am trying to copy from one workbook to another but get a message as I move the sheet that a name already exists. is there a way to automatically ignore this message?
The message is: is:
the code for the copy
CurrentWorkBook.Sheets(Array("Compliance - learning")).Copy Before:=ActiveWorkbook.Sheets(1)
回答1:
I think you are looking for
Application.DisplayAlerts = False
CurrentWorkBook.Sheets(Array("Compliance - learning")).Copy Before:=ActiveWorkbook.Sheets(1)
Application.DisplayAlerts = True
来源:https://stackoverflow.com/questions/40134749/how-to-ignore-name-xxx-already-exists-messages-when-moving-sheets-in-excel-vba