Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Iteration Sub wont work with Toggle Button Accessed Indirectly

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Toggle Calc Button - how to make it work OK at startup Mike Excel Programming 4 August 21st 05 08:24 AM
Adding .xla button for Toggle Calculation Button Mike Excel Programming 5 August 19th 05 01:55 PM
Anyone know why this wont work? Mark Stephens Excel Programming 2 June 13th 05 06:08 AM
Button using Form, Iteration and Input values coco Excel Programming 2 June 4th 05 02:00 PM
Why wont this code work? Mark Stephens[_3_] Excel Programming 1 April 30th 05 07:01 PM


All times are GMT +1. The time now is 02:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"