美好的一天!
我有一个ActiveX按钮(根据顶部的行数固定在位),它运行VBA代码以在特定点插入指定数量的复制行。代码本身工作正常,但按钮"克隆"即使我已设置Application.ScreenUpdating = False
,也会将自身叠加在新行的位置。再次启用屏幕更新后,屏幕将刷新并且克隆消失。
我已将其追踪到一行代码:Selection.Insert Shift:=xlDown
一旦该行运行,就会克隆该按钮。
例如,如果我使用此宏添加3个空行,则一旦执行上述命令直到子例程完成,该按钮将如下所示:
为了使这更有趣,当我使用Excel 2010时,这种行为不会发生。我前几天升级到Excel 2013,现在出现了这个问题。
有什么想法吗?
答案 0 :(得分:0)
I have experience similar behavior when Application.ScreenUpdating = False. I don't think there is really a good answer for this. There are just workarounds as far as I know.
You are likely pushing the button up or down with the insert and when Application.ScreenUpdating = False things still "sort of" update. If you want it to go away you could try a few things.
Or post the code (as simplified as possible, yet demonstrates the issue) that is executing between when you insert and when you Application.ScreenUpdating = True.
I hope that is helpful.