本文介绍了构建撤销到Excel VBA宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Excel宏运行后似乎不允许使用撤消。有没有办法在Excel中将 undo
功能复制到VBA宏?
Excel macros do not seem to allow the use of "undo" after running them. Is there any way to bake undo
functionality into a VBA macro in Excel?
推荐答案
Excel VBA具有 Application.OnUndo
函数来处理这一点:
Excel VBA has the Application.OnUndo
function to handle this:
Public Sub DoSomething
... do stuff here
Application.OnUndo "Undo something", "UnDoSomething"
End Sub
Public Sub UnDoSomething
... reverse the action here
End Sub
这篇关于构建撤销到Excel VBA宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!