Results 1 to 1 of 1

Hope this is not impossible. An Undo Handler/ Macro to undo using keyboard shortcut

Threaded View

akaytie Hope this is not impossible. ... 11-22-2014, 05:02 PM
  1. #1
    Registered User
    Join Date
    11-12-2014
    Location
    USA
    MS-Off Ver
    office 2010 and 2013
    Posts
    40

    Hope this is not impossible. An Undo Handler/ Macro to undo using keyboard shortcut

    This is the last missing piece of the puzzle I need for this workbook VBA project. I am hoping and praying someone will be kind enough to help. I have a gun to my head so to speak right now. I have to present the workbook this Monday at 8:30am mountain standard time to the VP of the University I work for. I just know he will want a user to be able to undo what he or she has done to fix their mistakes. I know that excel automatically disables the undo buttons and so one must code this functionality into the workbook if the workbook contains macros and/or VBA programming. I have read the tutorial at www.jkp-ads.com.

    Unfortunately I am new to VBA programming and don't really understand my own code well enough to take her code and customize this for my project. I am thinking that all I need to do is cut and paste her Class Modules 1 and 2 as written into a class module in my own workbook project. But I don't know for sure. Moreover where I am really unsure is how to implement these actions in a normal module especially to a keyboard shortcut. The specific code I am referring to is:

    Option Explicit
    
    Dim mUndoClass As clsExecAndUndo
    
    Sub MakeAChange()
        Dim i As Integer
        If mUndoClass Is Nothing Then
            Set mUndoClass = New clsExecAndUndo
        Else
            'Previous undoset, must be removed
            Set mUndoClass = Nothing
            Set mUndoClass = New clsExecAndUndo
        End If
        For i = 1 To 10
            mUndoClass.AddAndProcessObject ActiveSheet.Cells(i, 1), _
                    "Interior.Colorindex", 15
        Next
        Application.OnUndo "Restore colours A1:A10", "UndoChange"
    End Sub
    This code above looks to me like it is specific to her tutorial workbook.

    Now here is a summary of what the code does in my workbook project. I am conducting a survey of all university owned buildings (around 300 throughout the state). I need people who know the answers to my questions to answer them in the worksheet. For example, the attached worksheet will sent to the Environmental, Health, and Safety department. They will answer questions such as: (1) Does a building have a fire sprinkler system, (2) are flammables stored, (3) Is welding performed... etc. When they open the workbook they only see the instructions worksheet. Once they read the instructions they click on the "Display Sheets" and a userform is displayed where they input their name and employee id (uNID) into the userform date stamping the time they start work. They click the START command button and the EHS sheet is displayed (sheets LISTS, CHANGELOG, and USERLOG are hidden). In the worksheet itself, every time a user makes a change to a cell, the text changes to blue and the row is date stamped with their employee id. If they mark DELETE is the STATUS cell, the row will be formatted in red text that is struck through. These changes are also recorded on the CHANGELOG sheet. Once they complete their work either for the day or for final submission back to me, they have to date stamp when they end their review before closing excel. When they attempt to close, the userform is displayed and they can select to SAVE(as) and/or END the review. Clicking on the END command button automatically saves the workbook, date stamps with their employeeID, and closes the Excel application.

    To access the worksheet all you need to do is put in your name (real name or imaginary) and any number that has 8 characters. I suggest u1234567. Or you can enter design mode and manually unhide all worksheets.

    Please if anyone can help me code into this workbook an undo handler that can be run with a shortcut key, I will be forever in your debt not to mention alive so to speak. After all I do have a gun to my head in the form of a meeting with the VICE PRESIDENT to the University and my boss's boss.

    Kaytie
    Attached Files Attached Files
    Last edited by akaytie; 11-22-2014 at 05:03 PM. Reason: formatting for readability

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Undo command has changed to Can't Undo
    By rodich in forum Excel General
    Replies: 6
    Last Post: 06-27-2013, 02:15 AM
  2. Replies: 0
    Last Post: 02-29-2012, 01:40 PM
  3. Undo function to undo Visual Basic commands
    By pierre08 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-15-2010, 04:59 AM
  4. VBA Undo & Excel's built-in Undo
    By dlh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-30-2007, 05:02 PM
  5. Need to undo tile using keyboard shortcuts only
    By gia in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 11-24-2006, 09:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1