Hello I am trying to create a Radio button in a cell that calculates the entire workbook rather than pressing F9.
I am not friendly with macro's yet so would prefer not to use any but I must learn....
Cheers
Martyn
Hello I am trying to create a Radio button in a cell that calculates the entire workbook rather than pressing F9.
I am not friendly with macro's yet so would prefer not to use any but I must learn....
Cheers
Martyn
Create an AutoShape or Forms button, and assign this macro:
![]()
Please Login or Register to view this content.
Entia non sunt multiplicanda sine necessitate
I can't fathom how creating and coding a special button is better than just pressing F9. There is always the moment when we all "need to learn them", as you say, but I don't see how this qualifies.
Anyway. Simplest:
1) Turn on the Control Toolbox Toolbar
2) Click on Command Button icon
3) Draw your button on your sheet somewhere (it will appear with a name like CommandButton1)
4) Right click on your new button and select Properties
5) Find the Caption and change "CommandButton1" to "Calculate"
6) Set your Font choice and BackColor choice
7) Set TakeFocusOnClick to False (this will keep your activecell focus where it is, even when you click the button)
8) Close the Properties window
9) Right-click the button and select VIEW CODE, a VBA window will appear with header/footer for your command button already there, but no code in between, add the word Calculate in between.
10) Press ALT-Q to close the VBEditor.![]()
Please Login or Register to view this content.
11) Save your sheet.
12) On the Control Toolbox toolbar, click on the EXIT DESIGN MODE button
Your button is now active. Click your button to calculate the workbook.
_________________
Microsoft MVP 2010 - Excel
Visit: Jerry Beaucaire's Excel Files & Macros
If you've been given good help, use theicon below to give reputation feedback, it is appreciated.
Always put your code between code tags. [CODE] your code here [/CODE]
?None of us is as good as all of us? - Ray Kroc
?Actually, I *am* a rocket scientist.? - JB (little ones count!)
Hi Thank you very much.
As for the reasoning I am writing a program, and I have created a data entry sheet I wanted the button as not all the program users will know that F9 is calculate and on auto calculate all the result cell's have Divide by 0 errors.
1) A note on the sheet "Press F9 to calculate" pretty much educates new users.
2) Any formula that divides by a cell that could be empty should be rewritten. If the formula =A1/B1 gives an error when B1 is empty, evaluate cell B1 first....like so:...and on auto calculate all the result cell's have Divide by 0 errors.
=IF(B1=0,"",A1/B1)
That technique can be adapted to solve most equations that result in errors when data is missing. It's a habit worth getting into and is far more useful than turning off calculations and hope you/others remember to update by pressing F9 or a button.
My two cents.![]()
Hi,
I do intend to clean up the missing data errors but at the moment I am concentrating on getting the program working which is now seriously complex,
Currently the program occupies 61 sheets to produce the required data.
Cheers for all the help it is very much appreciated!
That seems extraordinarily complex for anything short of designing nuclear weapons.Currently the program occupies 61 sheets to produce the required data.
If that takes care of your need, be sure to EDIT your original post, click on GO ADVANCED and set the PREFIX box to [Solved].
Is there a code to do a calculate for just that sheet, ie. Shift + F9 ?![]()
Please Login or Register to view this content.
Wonderful, many thanks !!!
Two things:
Notice thats plural, worksheets.![]()
Please Login or Register to view this content.
Second, the line of code
...implies you may be using .Select a bit in your code. Don't do that.![]()
Please Login or Register to view this content.
One thing that has to be done is code you learn how to write using the macro recorder (which I still use most days) needs to be cleaned up afterward to remove all the unnecessary selecting. Post up your entire macro and we can make some suggestions.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks