Undo button

dan2

Board Regular
Joined
Mar 26, 2002
Messages
60
I seem to be full of questions today

How do I put a button on my spreadsheet that will do the same function as the undo button on the tool bar?
(the tool bar is hidden from the end user)

Thanks in advance (again)

Dan
 
Chers guys you have underlined mt teaching.. no go best what you do on the way in reverse on the way out.

the tips are all bar the same, we are working the same way..

Cheers guys..

Nice code ill give it a play dk
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi guys,
this actually is quite an old topic, I know... just found this through the search function however, and was wondering whether any of you could help me with an issue I´m facing at the moment.
What I´m trying to do is using application.OnUndo in case the "If"-value is not true... i.e. ticking the box means showing text in a cell and unticking it would trigger reverse action (deleting the previous step and the text)

my problem is that the way I´ve put it together so far doesn´t really lead to a success even though it looks good to me ;)
This is what I´ve got so far:

Code:
Private Sub CheckBox2_Click()

    Dim x As String
    Dim x As String
    
        x = "AB"
        y = "A02"
        
        If 
***.CheckBox2 = True Then
            ***.Range("A6") = y
            ***.Range("d6") = x
            
        ElseIf ***.CheckBox2 = False Then
            MsgBox "deleted"
            Application.OnUndo "Undo CheckBox2", "UndoCheckBox2"
End If
            
End Sub

Sub UndoCheckBox2()
***.Range("A6").ClearContents
***.Range("d6").ClearContents

End Sub

Would be happy about any comments or help :)
thanks!
 
Upvote 0
Hi guys,
this actually is quite an old topic, I know... just found this through the search function however, and was wondering whether any of you could help me with an issue I´m facing at the moment.
What I´m trying to do is using application.OnUndo in case the "If"-value is not true... i.e. ticking the box means showing text in a cell and unticking it would trigger reverse action (deleting the previous step and the text)

my problem is that the way I´ve put it together so far doesn´t really lead to a success even though it looks good to me ;)
This is what I´ve got so far:

Code:
Private Sub CheckBox2_Click()

    Dim x As String
    Dim x As String
    
        x = "AB"
        y = "A02"
        
        If 
***.CheckBox2 = True Then
            ***.Range("A6") = y
            ***.Range("d6") = x
            
        ElseIf ***.CheckBox2 = False Then
            MsgBox "deleted"
            Application.OnUndo "Undo CheckBox2", "UndoCheckBox2"
End If
            
End Sub

Sub UndoCheckBox2()
***.Range("A6").ClearContents
***.Range("d6").ClearContents

End Sub
Would be happy about any comments or help :)
thanks!

sorry it should read
Dim x As String
Dim y As String
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,847
Members
449,051
Latest member
excelquestion515

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