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

Thanks, Rick; they work great - but I want the command button to be on the
Excel toolbar (and not in a worksheet), and I don't know how to create the
toolbar button and link it to these macros. Any advice on that also would be
appreciated!

"Rick Rothstein (MVP - VB)" wrote:

These two event procedures should do what you asked for...

Private Sub CommandButton1_Click()
Application.Calculation = xlCalculationAutomatic + _
xlCalculationManual - _
Application.Calculation
CommandButton1.Caption = IIf(Application.Calculation = _
xlCalculationManual, "MANUAL", "AUTO")
End Sub

Private Sub Worksheet_Activate()
CommandButton1.Caption = IIf(Application.Calculation = _
xlCalculationManual, "MANUAL", "AUTO")
End Sub

Rick

Need to create a command button that when first created (when a workbook
is
opened), it checks the calculation state and if calc is set to auto, the
button caption will say "AUTO"; if calc is set to manual, the button
caption
will say "MANUAL". Then the user should be able to hit the button to
toggle
back and forth between auto and manual calculation, with the button
caption
changing appropriately each time. I only know the basics of creating a
button....and have not been able to figure this out. Can someone help me
with this please?