"Reset" back to initial values

bunnyball88

New Member
Joined
Aug 21, 2013
Messages
8
I am creating a dashboard, governed by certain assumptions. I'd like for my customer to be able to change those assumptions (e.g. change the price of the widget to see how that changes the output in the dashboard), and futz around, but then, if they want, be able to "hit a button" and have it re-install the values and / or formulas that formed the initial assumptions.

Is there a way to do that?

Supernew to VBA and macro's so I apologize in advance if this is either very basic or, if upon explanation, i ask for more clarity!

Thank you!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi bunnyball,

It is simple to put a button onto a worksheet that runs a macro, and it is fairly simple to write a macro that will input formulas and values into the cells that you want. If you are going to let clients overtype your data with changes, is it fair to assume that most of these will be static values as opposed to formulas?

As a most basic example, the following code will input the value 12 into cell A1 of the active sheet whenever the code is run:


Sub RESET()

Range("A1").Value = 12

End Sub
 
Upvote 0
Hello ExcelUser616!

If it makes it meaningfully easier, then I could wind up inputting the assumptions they are able to write over as static at the end (for now, I am keeping them dynamic because we are still playing with our base assumptions and i don't want to have to continually hardcode).

Is way to have it so that the reset refers back to another cell (vs. a value)? and can i do it across a range so that B2 will look to A2, B3 to A3, etc?

Thank you again!
BB
 
Upvote 0
I would create 2 sheets...
One Master, and one that users can "futz" with.

Make them Identicle.


Then you can run a macro that just copies the master over the top of the user's.

Code:
Sub Reset()
Sheets("Master").Cells.Copy Destination:= Sheets("Futzwithit").Range("A1")
End Sub

You can even Hide the master sheet, and the code will still work.
 
Upvote 0
This is incredibly helpful and makes a lot of sense....
Next questions:
1) Is there a way i can have it so that i can have separate buttons to reset certain "sections" within the same page-- e.g. i want them to be able to play with variables related to widget 1 (in a certain section of the worksheet), or widget 2 (in another) and reset them separately.... possible? If not, not a big deal, it's definitely "nice to have" vs. "must have".
2) How do i actually enter the above macro and link it to a button?

Thank you!
 
Upvote 0
Sure, you can drill that code down to specific ranges..

Again based on having 2 identicle sheets..

Code:
Sub Reset()
Sheets("Master").Range("B20:G40").Copy Destination:= Sheets("Futzwithit").Range("B20:G40")
End Sub


Or even have it just replace whatever section the user currently has highlighted...

Code:
Sub Reset()
Sheets("Master").Range(Selection.Address).Copy Destination:= Sheets("Futzwithit").Range(Selection.Address)
End Sub
 
Upvote 0
How do you suggest I enter it? I am going through what I understand to be the right steps - creating a new module, pasting in the code, adjusting the ranges and sheet titles as appropriate - but i am getting "Run-time error '1004': Copy method of range class failed"....
thoughts?

(thank you!)
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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