Hide worksheet changes when userform displayed

G

Guest

I have a userform that is displayed when the workbook is opened. After it is
displayed, I add a new sheet and fill it with data. I want for the userform
to stay displayed while the sheet is added and updated, but I am having
trouble making this happen. Here is what I have:

In ThisWorkbook module:

Private Sub Workbook_Open()
UserFormMain.Show
End Sub

In UserFormMain:
Public Sub UserForm_Initialize()

appH = Application.Height
appW = Application.Width
appName = Application.Name
winTop = ActiveWindow.Top
winUHeight = ActiveWindow.UsableHeight

Height = appH
Width = appW

Application.ScreenUpdating = False
' Add new sheet and fill with data
ThisWorkbook.FormGroups_Initialize
Application.ScreenUpdating = True

End Sub


Thanks,
Frank
 
J

Jim Cone

Frank,
Put the worksheet changes in a separate sub within the form module.
Call that sub from the UserForm Activate event.
Put multiple Repaint statements in the sub.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"FClifton" <[email protected]>
wrote in message
I have a userform that is displayed when the workbook is opened. After it is
displayed, I add a new sheet and fill it with data. I want for the userform
to stay displayed while the sheet is added and updated, but I am having
trouble making this happen. Here is what I have:

In ThisWorkbook module:

Private Sub Workbook_Open()
UserFormMain.Show
End Sub

In UserFormMain:
Public Sub UserForm_Initialize()
appH = Application.Height
appW = Application.Width
appName = Application.Name
winTop = ActiveWindow.Top
winUHeight = ActiveWindow.UsableHeight

Height = appH
Width = appW

Application.ScreenUpdating = False
' Add new sheet and fill with data
ThisWorkbook.FormGroups_Initialize
Application.ScreenUpdating = True
End Sub
Thanks,
Frank
 

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