Export (0) Print
Expand All

EndUndo Method

Office 2003

Specifies the end of an undo block. This means that all statements between this call and its corresponding BeginUndo method call will be undone by a single call to the Undo method. This makes it possible for you to combine entire macros into one statement that can be easily undone. Undo blocks can be nested.

expression.EndUndo

expression    An expression that returns a ChartSpace or Spreadsheet object.

Example

This example creates an undo block containing code that sets the number format and font for cell D10. You can undo all of the formatting by clicking Undo on Spreadsheet1's toolbar.

Sub UndoBlock()
    Dim rngCurrent
    
    ' Enable undo.
    Spreadsheet1.EnableUndo = True
    
    ' Start an undo block.
    Spreadsheet1.BeginUndo
    
        Set rngCurrent = Spreadsheet1.Worksheets("sheet1").Range("D10")
        
        ' The following three lines of code apply
        ' various formatting to cell D10.
        rngCurrent.NumberFormat = "0.###"
        rngCurrent.Font.Color = "Blue"
        rngCurrent.Font.Name = "Times New Roman"
    
    ' End the undo block.
    Spreadsheet1.EndUndo
End Sub

		




Show:
© 2014 Microsoft