Reset/Default Button

  • Thread starter Thread starter Dan D.
  • Start date Start date
D

Dan D.

Is there any way to add a toggle or reset button to reset a
cell back to a constant, or even a formula? I sometimes
overwrite a cell formula to get what if's, and would like
an easy way to reset the cells back to the original formula.
 
--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Isn't that what the undo button does for you?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
If all I did was backup, that would be fine. But if I
change cells in one order, and want to back up with
different data, then undo won't cut it. I would like to
just place a button in a cell to cause another cell to
default back to an original formula.
 
One way:

Create a duplicate of your sheet (at least the formulae and constants)
and hide it (you can set it to xlVeryHidden in the VBE if you don't want
anyone to see it in the Format/Sheets/Unhide menu).

then attach this macro to a keyboard shortcut, toolbar button or menu
item:

Public Sub Restore()
If ActiveSheet.Name <> "Main" Then Exit Sub
With Sheets("MyHiddenSheet").Range(ActiveCell.Address)
If Not IsEmpty(.Value) Then _
ActiveCell.Formula = .Formula
End With
End Sub

Change "Main" and "MyHiddenSheet" to suit.
 
I still don't think that will do it. I would want to only
reset certain cells, and probably reset individual cells at
different times.
 
the code would reset the activecell at any time.

Perhaps if you made it a bit clearer under what circumstances you
expected to reset - i.e., under program control? user control? many
individual cells at once? only one at a time?

I'm sure you understand exactly what you want, but it's a bit fuzzy from
here.
 
OK, here goes. I have 6 cells in a worksheet that have
results calculated from other data in the worksheet (ie the
6 cells contain formulas.) during the course of working
with my data, I overwrite those cells, some or all, with
constants to have the rest of the worksheet calculate other
cells. When I want to revert one, or all, of the cells
back to their original fomulas, I either have to undo
EVERYthing and start over, or exit without saving and load
the worksheet all over again, and reenter data all over
again. I am looking for a way to place a toggle or button
someplace, probably in an adjacent cell, so that I can just
click to revert to (or technically reenter) the original
formula. I'm not a wizzard at this, but it seems there
should be a way to just hit a toggle or button with the
mouse to have pre-determined data or formulas automatically
entered into a cell. Kind of like hitting a DEFAULT button
in some programs will reset any user defined settings. I
hope that explains it better. It would help me out a lot
if I could get something like that working. DD.
 
Modify the macro I gave you earlier a little:

Assume your 6 cells are A1,B2,C3,D4,E5 and F6. Copy those formulae to a
new sheet in the same locations. Hide the sheet. Attach this macro to a
button on the sheet:

Public Sub Restore()
Dim rCell As Range
For Each rCell in Range("A1,B2,C3,D4,E5,F6")
With rCell
.Formula = Sheets("HiddenSheet").Range(.Address).Formula
End With
Next rCell
End Sub
 
Back
Top