在 Excel VBA 中移动工作表时如何忽略“名称 XXX 已存在”消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40134749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 11:23:52 来源:igfitidea点击:
How to ignore "name XXX already exists" messages when moving sheets in excel VBA
提问by Marc L
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 code for the copy
复制代码
CurrentWorkBook.Sheets(Array("Compliance - learning")).Copy Before:=ActiveWorkbook.Sheets(1)
回答by PartyHatPanda
I think you are looking for
我想你正在寻找
Application.DisplayAlerts = False
CurrentWorkBook.Sheets(Array("Compliance - learning")).Copy Before:=ActiveWorkbook.Sheets(1)
Application.DisplayAlerts = True