ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide worksheet changes when userform displayed (https://www.excelbanter.com/excel-programming/385102-hide-worksheet-changes-when-userform-displayed.html)

FClifton

Hide worksheet changes when userform displayed
 
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


Jim Cone

Hide worksheet changes when userform displayed
 
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"
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


FClifton

Hide worksheet changes when userform displayed
 
Thanks Jim, that seems to work

"Jim Cone" wrote:

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"
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




All times are GMT +1. The time now is 04:56 PM.

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