ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Follow up to "Recalculate" problem (https://www.excelbanter.com/excel-worksheet-functions/56330-follow-up-recalculate-problem.html)

Lee Harris

Follow up to "Recalculate" problem
 
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



Dave Peterson

Follow up to "Recalculate" problem
 
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.

Lee Harris wrote:

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


--

Dave Peterson

Lee Harris

Follow up to "Recalculate" problem
 

"Dave Peterson" wrote in message
...
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!




All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com