PDA

View Full Version : Solved: Worksheet not Displaying



coliervile
02-25-2008, 06:41 AM
Good morning everyone. When I run the following macro the worksheet "Printout" displays and then when it closes the macro is suppose to display the worksheet "Dashboard" and then show the userform "frmRequest". The macro seems like it doesn't have time to display the "Dashboard" before the userform loads. The userform loads up and if you close the userform then the worksheet "Dashboard" fully dispalys. Is there a reason this is happening and how do you fix it? By the way the "Dashboard" is not hidden.

Best regards,

Charlie


Private Sub CommandButton3_Click()
Application.ScreenUpdating = False
Unload frmRequest
Sheets("Printout").Visible = True
Sheets("Printout").Select
ActiveWindow.SelectedSheets.PrintPreview
Sheets("Printout").Visible = False
Sheets("Dashboard").Select
frmRequest.Show
Application.ScreenUpdating = False
End Sub

gwkenny
02-25-2008, 06:48 AM
Hi!

In VBA help, lookup what "Application.ScreenUpdating" does and what happens when you set it to false :)

Good luck!

coliervile
02-25-2008, 07:06 AM
Excellent tip gwKenny"...you can radically speed up your macro by turning off the screen updating while the macro runs. You would add this line of code to your macro:

from Old Coding:

Sub Test()
Application.ScreenUpdating = False
...macro code here
Application.ScreenUpdating = False
End Sub

to New Coding:

Sub Test()
Application.ScreenUpdating = True
...macro code here
Application.ScreenUpdating = False
End Sub

Thanks for the tip...

Best regards,

Charlie

Bob Phillips
02-25-2008, 07:44 AM
You mean




Sub Test()
Application.ScreenUpdating = False
...macro code here
Application.ScreenUpdating = True
End Sub

coliervile
02-25-2008, 08:23 AM
Ooops sorry about that'

Charlie

coliervile
02-25-2008, 08:37 AM
Mistake

gwkenny
02-25-2008, 10:27 PM
Heh, never mind. I see this has been solved :D