View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Paige Paige is offline
external usenet poster
 
Posts: 270
Default Command Button That Will Toggle

For a workbook that is complex and has lots of formulas; I want the users to
be able to turn calc on/off more readily, and to be able to turn calc off
PIOR to opening one of these workbooks if they so desire, so was looking for
code to add to Personal.xls that when Excel launched, it would create the
button for them to use. Does that make sense?

"dan dungan" wrote:

Hi Paige,

Please help me understand why you want to create the button on open.

This seems that would just slow the opening of the workbook.

Dan

On Oct 26, 2:27 pm, Paige wrote:
Thanks, Dan, that's definitely half of it. I still need to develop a sub for
Private Sub Workbook_Open() that creates the button, checks the calculation
state when the workbook is opened, and titles the button to whatever the calc
state is, and then tie the toggling of that button to the code below. Can
you advise on that also?

"dan dungan" wrote:
Woops,


I didn't read your whole question.


Try this instead:


Private Sub CommandButton1_Click()
If Application.Calculation = xlCalculationAutomatic Then
Application.Calculation = xlCalculationManual
CommandButton1.Caption = "AUTO"
ElseIf Application.Calculation = xlCalculationManual Then
CommandButton1.Caption = "MANUAL"
Application.Calculation = xlCalculationAutomatic
End If
End Sub


Dan