Share via


EnableUndo Property

True if the undo functionality is enabled for the specified spreadsheet. Setting the EnableUndo property to False disables the undo functionality of the spreadsheet component. Read/write Boolean.

expression.EnableUndo

*expression   * Required. An expression that returns a Spreadsheet object.

Example

This example creates an undo block containing code that sets the number format and font for the cell D10.

Sub Undo_Block()
    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

Applies to | Spreadsheet Object

See Also | BeginUndo Method | EndUndo Method | Undo Method