ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ScreenUpdating stays TRUE no matter what? (https://www.excelbanter.com/excel-programming/345900-screenupdating-stays-true-no-matter-what.html)

[email protected]

ScreenUpdating stays TRUE no matter what?
 
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").Enable Calculation =
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").Enable Calculation =
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.


[email protected]

ScreenUpdating stays TRUE no matter what?
 
Has anyone ever had this happen where, screenupdating does not change
to false?


[email protected]

ScreenUpdating stays TRUE no matter what?
 
ScreenUpdating reverts to true when a macro ends


[email protected]

ScreenUpdating stays TRUE no matter what?
 
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.


[email protected]

ScreenUpdating stays TRUE no matter what?
 
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


Rowan Drummond[_3_]

ScreenUpdating stays TRUE no matter what?
 
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

wrote:
Has anyone ever had this happen where, screenupdating does not change
to false?


Tom Ogilvy

ScreenUpdating stays TRUE no matter what?
 
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.

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
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.




[email protected]

ScreenUpdating stays TRUE no matter what?
 
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.


[email protected]

ScreenUpdating stays TRUE no matter what?
 
Oh, I should add, that I removed the segment that writes the word
"TEST" to cell A23 which certainly would cause a calculation event


[email protected]

ScreenUpdating stays TRUE no matter what?
 
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.



All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com