Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Undo Code Not Quite Working
I'm trying to modify John Walkenbach's code to 'undo' a VBA procedure that
deletes one or more rows. John's original code was to undo zeroes put into a highlighted range. I can get the undo to work, except that once the rows are deleted and the undo button is selected, it puts the deleted rows back over existing data, versus 'inserting' them back into the correct place. I'm not sure how to modify the following to allow for this. Can someone help? ' This saves the current values for undoing ReDim OldSelection(Selection.Count) Set OldWorkbook = ActiveWorkbook Set OldSheet = ActiveSheet i = 0 For Each cell In Selection i = i + 1 OldSelection(i).Addr = cell.Address OldSelection(i).Val = cell.Formula Next cell ' This restores the saved information For i = 1 To UBound(OldSelection) Range(OldSelection(i).Addr).Formula = OldSelection(i).Val Next i |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop Undo Button from working in Excel 2007 after a Save | Excel Discussion (Misc queries) | |||
UNDO in Office 2007 Excel not working. How fix? | Excel Discussion (Misc queries) | |||
Why can cause undo and redo to stop working? | Excel Discussion (Misc queries) | |||
UNDO in VBA code??? | Excel Programming | |||
Undo not working with macro | Excel Programming |