Follow up to "Recalculate" problem

L

Lee Harris

I have a workbook with several sheets in it, each one has a button which I
use to force recalculation of various things for a game based idea.

When I do Alt-F11 I see that I have the following code

Option Explicit
Private Sub CommandButton1_Click()
Application.Calculate
End Sub


but this appears under "VBAProject", "Microsoft Excel Objects" and then the
code is on each sheet that I have a button for, obviously

What I want to know is, can I retain the functionality I have BUT have it so
that if I press a button on say the "Solitaire" worksheet, it only
recalculates the stuff on that sheet

Actually the fact that the buttons recalculate all sheets is OK for all
buttons except one, so I guess what I really need is just a way to isolate
the one button on the one sheet, so that it only randomises/recalculates on
its own specific sheet

does that make sense?

tks in advance
 
D

Dave Peterson

Option Explicit
Private Sub CommandButton1_Click()
Me.Calculate
End Sub

Since you're in a worksheet module, "Me" refers to that worksheet that owns the
code.
 
L

Lee Harris

Dave Peterson said:
Option Explicit
Private Sub CommandButton1_Click()
Me.Calculate
End Sub

Since you're in a worksheet module, "Me" refers to that worksheet that
owns the
code.

thanks a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top