Klick button for [F9] function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm a real amateur trying to learn. If you have an answer, please make it so
that it's understandable for me to perform solution.. Now heres what I want
to do:

I've made a simple random number function to pick winning numbers in a
lottery.. I would like to be able to perform the function of pressing F9
button, just by klicking a button in the worksheet.. How do I do that?!
 
Insert this in a regular module

Sub calcNow()
Calculate
End Sub

Insert a Formular-button and link to calcNow macro


"Espen Rostad" skrev:
 
There is a calculate now button under Tools>Customize>Commands>Tools that you
can drag to your Toolbar.

If you want a button "on the worksheet" go to Tools>Customize and open the
Control Toolbox toolbar.

Select design mode then click on the Command Button and draw one on your sheet.

Right-click and "View Code"

You will get these two lines in a module

Private Sub CommandButton1_Click()

End Sub

Add Calculate between the lines to get this.

Private Sub CommandButton1_Click()
Calculate
End Sub

Close the module and exit design mode.

Click the button to calculate.


Gord Dibben MS Excel MVP

On Fri, 4 May 2007 03:57:01 -0700, Espen Rostad <Espen
 
Back
Top