Share via

Application.Undo

Anonymous
2011-03-10T20:24:15+00:00

I can undo the last user command with:

Sub GoBack()

Application.Undo

End Sub

This appears to be the equivalent to touching the undo button in the QAT.

I can simulate touching the redo button on the QAT with:

Sub GoForward()

Application.SendKeys ("^y")

End Sub

Is there a way to do this without using SendKeys?

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2011-03-10T23:20:32+00:00

Your GoBack macro does both... ;-)

The Application.Undo method works differently than the QAT button. It undoes only the last action, instead of working its way back through the undo stack. Hence, the first time you run GoBack, it will undo the last action. The next time, it will undo the undo, i.e. it will perform a redo!

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2011-03-11T00:58:32+00:00

    Thanks!

    Was this answer helpful?

    0 comments No comments