ScreenUpdating stays TRUE no matter what?

  • Thread starter Thread starter werbitt
  • Start date Start date
W

werbitt

Hi, I have successfully used the "Application.ScreenUpdating = False"
statement in the past, but for some reason it is not working for me
now. Here is my VBA:

Sub calculateEvent()
Dim row As Integer
Dim isBlank As Boolean

'Turn off calculations and screen updating
Application.ScreenUpdating = False
Workbooks("Master.xls").Sheets("CurrentSD").EnableCalculation =
False

'Go through row by row, determine if any SDs are greater than 2
row = 2
isBlank = False
'If SD greater than 2 determine status and take appropriate action
Do While isBlank = False
If Workbooks("Master.xls").Sheets("CurrentSD").Range("D" &
row).Value >= 2 Then
If Workbooks("Master.xls").Sheets("CurrentSD").Range("E" &
row).Value = "NULL" Then
'CALL openProposal()
End If
If Workbooks("Master.xls").Sheets("CurrentSD").Range("E" &
row).Value = "OPEN" Then
'Call reopenProposal()
End If
If Workbooks("Master.xls").Sheets("CurrentSD").Range("E" &
row).Value = "CLOSING" Then
'Call cancelCloseProposal()
End If
End If
'increment row
row = row + 1
If Workbooks("Master.xls").Sheets("CurrentSD").Range("A" &
row).Value = "" Then isBlank = True
Range("A23").Value = "test"
Loop
'Turn on Calculations and screen updating
Workbooks("Master.xls").Sheets("CurrentSD").EnableCalculation =
True
Application.ScreenUpdating = True
End Sub

If I step through the code and mouseover Application.ScreenUpdating
directly after the "Application.ScreenUpdating = False" statement it
still says "Application.ScreenUpdating = TRUE"?!?!?! Is there some
setting I don't know about that is not letting me turn off screen
updating.
 
No, I'm saying that screen updating NEVER changes to false. Right
after the line: Application.ScreenUpdating = False, if I hover over
screenupdating it still says it = true. It is very strange.
 
I've run into problems before, not realizing that at the end of a macro
screen updating reverts to True, but I've never had your problem
before, good luck
 
Hi

I get the same thing hovering my mouse over the line, however if I run
the macro the screen does not update until the end so the desired affect
is achieved. If you just run the macro do you see screen flicker?

Regards
Rowan
 
It appears you are stepping through your code. Try just running your code.
I would assume when stepping through your code, the screenupdating is set
back to true when the code halts during the step process.
 
Thanks so much for your advice. After a little tinkering I have
determined that the screen flickering is caused by the fact that this
procedure is called from a WORKSHEET_CALCULATE() procedure (this code
was originally in the WORKSHEET_CALCULATE procedure, but I moved it
because I thought that might be what was affecting the screenupdating).
And that the flickering actually takes place _after_ the macro has
run. It is hard to tell but I am assuming that the number of flickers
corresponds with the number of times it goes through the DO WHILE loop.
I still think this is strange because there is nothing in this sub
that would cause a calcculation event _to my knowledge_. Does anyone
have any input on this? Is there a way to stop this flickering? Thanks.
 
Oh, I should add, that I removed the segment that writes the word
"TEST" to cell A23 which certainly would cause a calculation event
 
First off, sorry for my previous convoluted posts and original
question. It is clear to me now that the flicker is being caused by
having this code called from the worksheet calculation event. My
question now is What is causing the calculation event. I think it may
be the if statements checking and comparing values of cells on this
sheet. If that is so, that is unfortunate as I am trying very hard to
have as few calculation events as possible. It also raises the
question of why does't the flicker continue indefinately, if the macro
causes a calc event, and is called when a calc event occurs, and that
is what causes the flicker.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top