Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bob gave me the following macro to switch from calculation auto to
calculation manual and works just fine. What I would like to next is to change the color of the button from Red if manual to Green if automatic. Can do? Sub ToggleCalculation() With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You'll need to know the name of your command button. The code below is
using "CommandButton3". Sub ToggleCalculation() If Application.Calculation = xlCalculationManual _ Then With ActiveSheet.OLEObjects("CommandButton3").Object .BackColor = &HFF00& .Caption = "Auto" .ForeColor = &H0& End With Application.Calculation = xlCalculationAutomatic Else With ActiveSheet.OLEObjects("CommandButton3").Object .BackColor = &HFF& .Caption = "Manual" .ForeColor = &HFFFFFF End With Application.Calculation = xlCalculationManual End If End Sub HTH, Paul "Beep Beep" wrote in message ... Bob gave me the following macro to switch from calculation auto to calculation manual and works just fine. What I would like to next is to change the color of the button from Red if manual to Green if automatic. Can do? Sub ToggleCalculation() With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What kind of button - control toolbox, or forms ?
Tim "Beep Beep" wrote in message ... Bob gave me the following macro to switch from calculation auto to calculation manual and works just fine. What I would like to next is to change the color of the button from Red if manual to Green if automatic. Can do? Sub ToggleCalculation() With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Custom Button with a smiley face on the toolbar
"Tim" wrote: What kind of button - control toolbox, or forms ? Tim "Beep Beep" wrote in message ... Bob gave me the following macro to switch from calculation auto to calculation manual and works just fine. What I would like to next is to change the color of the button from Red if manual to Green if automatic. Can do? Sub ToggleCalculation() With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is impossible to see from your code what kind of cutton you are talking
about. If from the forms toolbar, then no. Why not use a toggle button from the control toolbox toolbar and then you shouldn't have to change the color. -- Regards, Tom Ogilvy "Beep Beep" wrote: Bob gave me the following macro to switch from calculation auto to calculation manual and works just fine. What I would like to next is to change the color of the button from Red if manual to Green if automatic. Can do? Sub ToggleCalculation() With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ToggleCalculation()
With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub All of the above subroutine's code can be replaced with this single line... Sub ToggleCalculation() Application.Calculation = (xlCalculationManual + xlCalculationAutomatic) - Application.Calculation End Sub Rick |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Rich, however I am trying to determine if I can have the button on the
toolbar (custom button) to change colors when the calculation changes from manual to automatic or vice versus. "Rick Rothstein (MVP - VB)" wrote: Sub ToggleCalculation() With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub All of the above subroutine's code can be replaced with this single line... Sub ToggleCalculation() Application.Calculation = (xlCalculationManual + xlCalculationAutomatic) - Application.Calculation End Sub Rick |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No you can't. You might want to change the icon on the button.
-- Regards, Tom Ogilvy "Beep Beep" wrote: Thanks Rich, however I am trying to determine if I can have the button on the toolbar (custom button) to change colors when the calculation changes from manual to automatic or vice versus. "Rick Rothstein (MVP - VB)" wrote: Sub ToggleCalculation() With Application If .Calculation = xlCalculationManual Then .Calculation = xlCalculationAutomatic Else .Calculation = xlCalculationManual End If End With End Sub All of the above subroutine's code can be replaced with this single line... Sub ToggleCalculation() Application.Calculation = (xlCalculationManual + xlCalculationAutomatic) - Application.Calculation End Sub Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Linking a cell to a toggle switch | Excel Programming | |||
Toggle switch between absolute and relative values creating a macr | Excel Discussion (Misc queries) | |||
Toggle on/off switch for x-y graph | Charts and Charting in Excel | |||
how to quickly toggle or switch to next worksheet | Excel Worksheet Functions | |||
How to toggle | Excel Programming |