MrExcel Publishing
Your One Stop for Excel Tips & Solutions

UserForms don't completely hide.


Posted by Ron on June 04, 2001 8:55 AM

I have a few VBA Userforms that I need to show and
hide. I'm using the code below, but the form isn't disappearing from view. It's staying in the background. Anyone else ever run into this problem??Thanks for all help!

frmCSWork.Hide
frmRSMenu.Show


Posted by Joe Was on June 04, 2001 9:25 AM

If you want the form to go away until called again use the "End" command rather than "Hide."

Posted by George Clements on June 04, 2001 9:27 AM

Hi Ron

Try the following:

Make sure the visible sheet is the active sheet before hiding the frmCSWork userform.

Also put in a 'doevents' command after you hide the frmCSWork userform.

Make sure screenupdating is set to true

Posted by Ron on June 04, 2001 9:30 AM

Thanks. I want the information in the form to stay, but the form to be hidden until called.

Posted by Joe Was on June 04, 2001 9:36 AM

If the form data is needed load it to global variables. These can be used over by other forms.
Then End the loading form. Can you re-tell what it is you want you seem to be contradicting?

Posted by Ron on June 04, 2001 9:43 AM

Sure. I have 6 forms. I want to be able to hide a form and show another form. However, when I hide a couple of the larger forms they are still visible and the new form appears on top. I didn't want to unload the forms so the user will be able to return to them to change information if necessary. Thanks for the quick assistance!

Posted by Ron on June 04, 2001 10:13 AM

Thanks George. I placed an activate method for the visible sheet before each form.hide and it seems to have worked.

Posted by Joe Was on June 04, 2001 10:30 AM


Excel has a big pallet. Are all your forms on one sheet or are they on different sheets?

If you hide a form how can a user see it to update it?

My solution would be to have a new sheet open with the form, named the name of the form then hide it by selecting the calling form at the end of the macro as the last statement. This way the user can go bact to the form by clicking the sheet tab if needed. A close button macro can delete the added sheets when pressed to Exit or you can write the delete new sheet code into the close form option. This way your application will be clean for the next use or user. If I am still not getting your problem, let me know?

Posted by Joe Was on June 04, 2001 10:40 AM

If the above is not a help?


Copy your offending code, whole macro, to this and post it. I may be able to build a better hide for you?