Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6245905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:35:34+00:00 2026-05-24T12:35:34+00:00

Can Anyone tell me how do I undo all my changes to my workbook?

  • 0

Can Anyone tell me how do I undo all my changes to my workbook?
I have file excel1.xlsx and I have did sorting and many operations on the excel.xlsx using vba. But at the end I want the excel1.xlsx to be the same which was at the start. How do i Undo all my changes using vba?

 activeworkbook.saved = True

I have found that it retains back all the contents as at the begginning but its not working.So is there any command where i can get back my original file after performing operations over it. Well yes

              wb1.Sheets(1).Activate
              ActiveWorkbook.Close savechanges:=False

It works but I dont want my workbooks to be closed it should be still opened. How do I make it? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:35:35+00:00Added an answer on May 24, 2026 at 12:35 pm

    In order to undo a sub routine, you can either choose not to save the file and just close it, or you have to write a special sub routine to save the state of the file, then restore the state (custom undo). This is one of the pains with sub routines is that they cannot be undone through normal undo. Most people, me including, will reccomend you work off a backup.

    When making your custome undo routine, the big question is what do you need to save the state for? Saving all information about the file would be unnessesarily heavy, so it’s good to know what you want to save.

    Update:
    This is a dirty way to backup the sheet if you only have 1 sheet of data. This is more of a proof of concept of one way to create a backup and not finalized perfect code. It just creates a backup copy of the currentsheet and when you’restore’ you are simply deleting the original sheet and renaming the backup to what it used to be called. :p

    How to test:
    Put some data and value in your original sheet then run the Test() sub-routine!

    Public backupSheet As Worksheet
    Public originalSheet As Worksheet
    Public originalSheetName As String
    
    Sub CreateBackup()
        Set originalSheet = Application.ActiveSheet
        originalSheetName = originalSheet.Name
        originalSheet.Copy After:=Sheets(Application.Worksheets.Count)
        Set backupSheet = Application.ActiveSheet
        backupSheet.Name = "backup"
        originalSheet.Activate
    End Sub
    
    Sub RestoreBackup()
        Application.DisplayAlerts = False
        originalSheet.Delete
        backupSheet.Name = originalSheetName
        Application.DisplayAlerts = True
    End Sub
    
    Sub ZerosFromHell()
        Range("A1:Z100").Select
        Cells.Value = 0
    End Sub
    
    Sub Test()
        Call CreateBackup
        Call ZerosFromHell
        MsgBox "look at all those darn 0s!"
        Call RestoreBackup
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone tell me how to add an AssemblyInfo.vb file to a Web Application
Can anyone tell me how to open Auto CAD file in HTML5? Is this
can anyone tell me how to list all subfolders in vb.net. i want to
Can anyone tell me what am i missing here: http://www.latitude18films.com/webtest/international.html All my Thumbnail with
Can anyone tell me how to remove characters after ? in php. I have
Can anyone tell me how to make connection in webconfig file (which don't require
Can anyone tell me how to get file name from editor? I just made
Can anyone tell me the command for updating a file in the SVN repository.
Can anyone tell me why num_chars and num_rows have to be the same? from
Can anyone tell me why I always have this strange output after running this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.