Screen "Flickers" When macro Starts !!
There are some functions (in the Analysis ToolPak, IIRC) that turn on
screenupdating. Maybe your code that uses solver suffers the same problem.
I don't think there's a way you can change the behavior of these functions, but
you can turn screenupdating off as soon as it gets turned back on.
I'd add some of these debug.print statements thoughout the code:
Debug.print "step 001." & application.screenupdating
You'll be able to see what piece of code changes that setting and your code can
react to it.
monir wrote:
Hello;
Sorry to bring up this old problem, but suddenly the screen flickers when I
click the button to run a relatively simple macro.
The Application.ScreenUpdating = False
does no longer have the effect of suppressing this initial jiggle!!
(I'm assuming that ScreenUpdating defaults back to True when the macro
terminates its execution.)
There're NO timers, NO event procedures, and NO other macros in this wb.
Could someone please shed some light on the possible cause ?? and how to fix
it ?
Here's the simple macro code which works fine apart from the flickering of
the screen when the macro starts.
Sub Spiral_Solver_4()
Dim myCheck As VbMsgBoxResult
'minimize the amount of flashing you see on the screen
Application.ScreenUpdating = False
' initialize values
Range("B13") = Range("B14")
Range("C13") = Range("C14")
Range("D17") = Range("A17")
Range("D18") = Range("A18")
Range("D19") = Range("E19")
Range("J16") = Range("H16")
Range("F13") = Range("F14")
SolverLoad LoadArea:="$J$20:$J$27"
SolverOptions MaxTime:=1000, Iterations:=10000, Precision:=0.0001, _
AssumeLinear:=False, StepThru:=False, Estimates:=2, Derivatives:=2, _
SearchOption:=2, IntTolerance:=5, Scaling:=False,
Convergence:=0.0001, _
AssumeNonNeg:=False
SolverOk SetCell:="$H$10", MaxMinVal:=3, ValueOf:="0", _
ByChange:="$D$17,$D$18,$D$19,$J$16"
'check if Solver failed
Test = SolverSolve(True)
MsgBox (Test) 'returns 0 or 1 for NO error
myCheck = MsgBox("0 or 1 OK." & Chr(10) & "Continue ??", vbYesNo)
If myCheck = vbNo Then
Exit Sub
End If
'continue with Solver if successful
SolverSolve Userfinish:=True
Solverfinish keepfinal = 1
Range("A1").Select
End Sub
Thank you kindly.
(Excel 2003 SP2, Windows XP)
--
Dave Peterson
|