Screen Updating problem with nested subroutines

G

Guest

I have a problem with the screen updating not working when using nested
subroutines. i.e.

Sub main()

Application.ScreenUpdating = False
nestedSub
Application.ScreenUpdating = True

End Sub

Sub nestedSub()

Application.ScreenUpdating = False
Code here...
Application.ScreenUpdating = True

End Sub

If I run nestedSub, there is no screen flicker. However if I run main, there
is flickering the whole time (as it calls nestedSub)

How can I get it so that if I run main, it only updates the screen after
ending main, not after running nestedSub and main?

Thanks
Atreides
 
J

Jim Cone

Remove the screenupdating code from "nestedSub"
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"Atreides" <atreides1AThotmailD0Tcom>
wrote in message
I have a problem with the screen updating not working when using nested
subroutines. i.e.
Sub main()
Application.ScreenUpdating = False
nestedSub
Application.ScreenUpdating = True
End Sub

Sub nestedSub()
Application.ScreenUpdating = False
Code here...
Application.ScreenUpdating = True
End Sub

If I run nestedSub, there is no screen flicker. However if I run main, there
is flickering the whole time (as it calls nestedSub)
How can I get it so that if I run main, it only updates the screen after
ending main, not after running nestedSub and main?
Thanks
Atreides
 
G

Guest

Jim Cone said:
Remove the screenupdating code from "nestedSub"

I should have stated that I want to also run nestedSub on it's own (i.e.
without calling main) and not have screen flicker. Currently, nestedSub
without that code creates screen flicker as it runs. That's why the
screenupdating code is in nestedSub.

(Sorry if my generic names are misleading)

Atreides
 
T

Tom Ogilvy

Sub main()

Application.ScreenUpdating = False
nestedSub
Application.ScreenUpdating = True

End Sub

Sub nestedSub()
Dim bState as Boolean
bState = Application.ScreenUpdating
If bState then _
Application.ScreenUpdating = False
Code here...
if bState then _
Application.ScreenUpdating = True
End Sub
 
G

Guest

Thanks Tom, that works!

Tom Ogilvy said:
Sub main()

Application.ScreenUpdating = False
nestedSub
Application.ScreenUpdating = True

End Sub

Sub nestedSub()
Dim bState as Boolean
bState = Application.ScreenUpdating
If bState then _
Application.ScreenUpdating = False
Code here...
if bState then _
Application.ScreenUpdating = True
End Sub
 

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

Top