View Single Post
  #3  
Old 07-04-2009, 02:39 PM
JBeaucaire's Avatar
JBeaucaire JBeaucaire is online now
Forum Guru
 
Join Date: 21 Mar 2008
Location: Bakersfield, CA
MS Office Version:2003 (can read 2007 files)
Posts: 9,532
JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay JBeaucaire makes giving solutions look like childsplay
Send a message via Skype™ to JBeaucaire
Re: Calculate Button

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.
Code:
Private Sub CommandButton1_Click()
    Calculate
End Sub
10) Press ALT-Q to close the VBEditor.
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.
__________________
If you've been given good help, use the icon to give reputation feedback, it is appreciated.
Always put your code between [code] and [/code] tags.
“None of us is as good as all of us” - Ray Kroc
“Actually, I *am* a rocket scientist.” - JB (little ones count!)
Reply With Quote