如何忽略“名称XXX已经存在";在Excel VBA中移动工作表时出现的消息 [英] How to ignore "name XXX already exists" messages when moving sheets in excel VBA

查看:66
本文介绍了如何忽略“名称XXX已经存在";在Excel VBA中移动工作表时出现的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从一个工作簿复制到另一个工作簿,但在移动工作表时已收到名称的消息.有没有一种方法可以自动忽略此消息?

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?

消息是:为:

副本代码

CurrentWorkBook.Sheets(Array("Compliance - learning")).Copy Before:=ActiveWorkbook.Sheets(1)

推荐答案

我认为您正在寻找

Application.DisplayAlerts = False
    CurrentWorkBook.Sheets(Array("Compliance - learning")).Copy Before:=ActiveWorkbook.Sheets(1)
Application.DisplayAlerts = True

这篇关于如何忽略“名称XXX已经存在";在Excel VBA中移动工作表时出现的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆