ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How keep user form constant (https://www.excelbanter.com/excel-programming/387622-how-keep-user-form-constant.html)

[email protected]

How keep user form constant
 
Hi I recently posted a question about a user form and got it working
and figured out how to get it into excel...however, the only problem
is it only runs as soon as excel starts up and then waits for the user
to exit out of the box. Also, while it is up, it restricts the spread
sheet from being edited. Is there a way I could have the box always
be there and be able to simultaneously edit the spreadsheet? Sorry if
it is a bit unclear.

thank you!


matt

How keep user form constant
 
On Apr 17, 7:51 pm, wrote:
Hi I recently posted a question about a user form and got it working
and figured out how to get it into excel...however, the only problem
is it only runs as soon as excel starts up and then waits for the user
to exit out of the box. Also, while it is up, it restricts the spread
sheet from being edited. Is there a way I could have the box always
be there and be able to simultaneously edit the spreadsheet? Sorry if
it is a bit unclear.

thank you!


You should be able to make the form Modeless and it will "float" in
the foreground until you unload or hide the form. It will allow you
to interact with Excel while the form is open.

Sub CommandButton1_Click()
frmExample.Show vbModeless
End Sub

Matt


timebird

How keep user form constant
 
the userform seems to be in modal.
you can get the userform show modal or modeless.
how about using "userform.show vbModeless"
when you write userform.show without vbModeless,
it shows in modal(vbModal is defalut)


msn
---------------------------------------------
the best time to plant a tree was twenty years ago.
the second best time, is today - Chinese proverb



" wrote:

Hi I recently posted a question about a user form and got it working
and figured out how to get it into excel...however, the only problem
is it only runs as soon as excel starts up and then waits for the user
to exit out of the box. Also, while it is up, it restricts the spread
sheet from being edited. Is there a way I could have the box always
be there and be able to simultaneously edit the spreadsheet? Sorry if
it is a bit unclear.

thank you!



[email protected]

How keep user form constant
 
On Apr 17, 9:51 pm, wrote:
Hi I recently posted a question about a user form and got it working
and figured out how to get it into excel...however, the only problem
is it only runs as soon as excel starts up and then waits for the user
to exit out of the box. Also, while it is up, it restricts the spread
sheet from being edited. Is there a way I could have the box always
be there and be able to simultaneously edit the spreadsheet? Sorry if
it is a bit unclear.

thank you!


Thank you for your response! I have one more question...is there a
way I could either make the box stay on just one worksheet (say one
called rev and exp) rather than having it stay open while looking at
other worksheets? Or could I directly embed it into a worksheet?


timebird

How keep user form constant
 
I think it's almost impossible to embed it to the worksheet.
for many years, i've tried but failed.

if you can make the userform show only on a specific worjsheet,
you would have better use event procedure.

for example,
Private Sub Worksheet_Activate()
userform1.Show vbModeless
End Sub

Private Sub Worksheet_Deactivate()
userform1.Hide
End Sub

--
msn
---------------------------------------------
the best time to plant a tree was twenty years ago.
the second best time, is today - Chinese proverb



" wrote:

On Apr 17, 9:51 pm, wrote:
Hi I recently posted a question about a user form and got it working
and figured out how to get it into excel...however, the only problem
is it only runs as soon as excel starts up and then waits for the user
to exit out of the box. Also, while it is up, it restricts the spread
sheet from being edited. Is there a way I could have the box always
be there and be able to simultaneously edit the spreadsheet? Sorry if
it is a bit unclear.

thank you!


Thank you for your response! I have one more question...is there a
way I could either make the box stay on just one worksheet (say one
called rev and exp) rather than having it stay open while looking at
other worksheets? Or could I directly embed it into a worksheet?



Jay

How keep user form constant
 
Hi Alex -

One way would be to hide the form when the worksheet of interest is
deactivated and show the form when it is activated. Here's some code to do
that.

1. Procedure to load the form (copy to standard module):

Sub alex()
If ActiveSheet.Name = "YourWorksheetNameHere" Then
frmAlex.Show vbModeless
Else
Load frmYourForm
End If
End Sub

2. Procedures to automatically show or hide the form (copy to the worksheet
module):

Private Sub Worksheet_Activate()
frmYourForm.Show vbModeless
End Sub

Private Sub Worksheet_Deactivate()
frmYourForm.Hide
End Sub

---
Jay




All times are GMT +1. The time now is 02:47 PM.

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