B
Brandt
I have included the code below in a Subroutine that a togglebutton calls when
it is clicked to the "True" value. The purpose is to turn the "Iterate
Calculations" on. This works fine with the toggle button. What I would like
to do is access this indirectly (without clicking the toggle button) in the
following manner. In the properties of the toggle button, set linked cell to
S9. In cell S9 put the code "=IF(A1 = "Yes",True,False)". This would allow
me to put "Yes" or "No" in A1 which changes S9 and therefore calls the
togglebutton click procedure (in an attemp to avoid having a button that
shows on the sheet). When I do this, the code for the togglebutton_change
gets run as is evidenced by various message boxes I have placed in the code
(including msgbox Application.Iteration which says the value is True), but
the Iteration box in tools | options does not get clicked. In short, if I
click the togglebutton directly, the code works and iterations is turned on.
If I change the toggle button by changing it's linked cell the code is run
(including to changes to the togglebutton.Caption, etc), but iterations is
not turned on.
Can anyone help me?
Thanks
'----------------------------------------------
'In Sheet1 Module
Private Sub tglInclSW1_Change() 'Have Tried _Click Also
If tglInclSW1.Value = True Then
tglInclSW1.Caption = "Yes"
Call CalcIteration
Else
tglInclSW1.Caption = "No"
End If
End Sub
'--------------------------------------------------
'In Standard Module ("ModCalcIteration")
Sub CalcIteration()
If Application.Iteration = False Then
With Application
.Iteration = True
.MaxIterations = 100
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
MsgBox "''Iterate Circular References'' has been Truned On." _
& Chr(10) & "To Turn Off Later, Goto: Tools | Options | Calculations -->
Uncheck ''Iteration''", vbOKOnly
End If
End Sub
it is clicked to the "True" value. The purpose is to turn the "Iterate
Calculations" on. This works fine with the toggle button. What I would like
to do is access this indirectly (without clicking the toggle button) in the
following manner. In the properties of the toggle button, set linked cell to
S9. In cell S9 put the code "=IF(A1 = "Yes",True,False)". This would allow
me to put "Yes" or "No" in A1 which changes S9 and therefore calls the
togglebutton click procedure (in an attemp to avoid having a button that
shows on the sheet). When I do this, the code for the togglebutton_change
gets run as is evidenced by various message boxes I have placed in the code
(including msgbox Application.Iteration which says the value is True), but
the Iteration box in tools | options does not get clicked. In short, if I
click the togglebutton directly, the code works and iterations is turned on.
If I change the toggle button by changing it's linked cell the code is run
(including to changes to the togglebutton.Caption, etc), but iterations is
not turned on.
Can anyone help me?
Thanks
'----------------------------------------------
'In Sheet1 Module
Private Sub tglInclSW1_Change() 'Have Tried _Click Also
If tglInclSW1.Value = True Then
tglInclSW1.Caption = "Yes"
Call CalcIteration
Else
tglInclSW1.Caption = "No"
End If
End Sub
'--------------------------------------------------
'In Standard Module ("ModCalcIteration")
Sub CalcIteration()
If Application.Iteration = False Then
With Application
.Iteration = True
.MaxIterations = 100
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
MsgBox "''Iterate Circular References'' has been Truned On." _
& Chr(10) & "To Turn Off Later, Goto: Tools | Options | Calculations -->
Uncheck ''Iteration''", vbOKOnly
End If
End Sub