UNDO in VBA

Status
Not open for further replies.

zazass8

New Member
Joined
Nov 29, 2022
Messages
10
Office Version
  1. 365
Platform
  1. MacOS
I created a sub that is able to undo a macro for me, by creating a copy of the original format then deleting the latest copy and retrieve the old copy back. When I am backing up that particular sheet I give it a different name. Then, when running the macro that I want to execute it cannot recognise anymore that copy that was created as it cannot identify it as an existing worksheet (RunTime Error '9').

What should I do to address this?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Store the info in a global variable and don't use the sheet name? Can't say much more than that because I don't see how you can delete a copy of a format. Plus, if "backing up" means copying, then the original sheet name should exist, so I don't get that part either - unless you mean the code exists behind both the original and the copied sheet and you're trying to run it from the copy.
 
Upvote 0
Duplicate to: Undo operation on a macro VBA

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,628
Messages
6,120,618
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top