Userforms,a need to unload?

Cerebum

Board Regular
Joined
Dec 2, 2008
Messages
183
I have created a workbook with quite a few userforms. Most of the userforms have listboxes. This is the first time I have really worked with them. The computers we have at work are not great but I have been having memory issues and was wondering if it is necessary to add code so that userforms/list boxes don't stay active after use.
I am using the code below to call the userform and generally using the "X" on the userform to exit. Should I add an Unload Me?

Code:
Sub Trunklinkform1()
UserForm12.Show
End Sub

Cheers guys
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
If you close using the X that should unload the form.
Do you have forms calling other forms?
 
Upvote 0
No, all the userforms are separate. I also assigned macros to command buttons rather than list box clicks just in case (paranoid :) ) what made me wonder was the fact that the list box in the userform appears with the previously selected option still highlighted. I was not sure if it was attempting to access it constantly or if it just happened to be selected.
 
Upvote 0
Are the listboxes linked to cells on worksheets using the ControlSource property, or are you assigning them a value in code when you load the form? If so, you would see a preselected item. If not, I'd suspect you are perhaps hiding the form rather than unloading it (which would involve code in the QueryClose event if you close by clicking the form X)
 
Upvote 0
I didn't add any code, just slapped the list box in and linked it to cells in the "RowSource" & "ControlSource" boxes. Would it be an easy out to just stick a command button on eack one linked to "Unload Me"
 
Upvote 0
The controlsource is why you are seeing items selected - whatever value is in the linked cell is the selected value in the listbox.
 
Upvote 0
Something interesting happened. I ran some code that clears some of the core data and each userform that links to the data appeared one after another in the VBA window! Any ideas how I stop this
 
Upvote 0
Don't bind the controls to the sheets or close the vbe while running the code. ;)
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,299
Members
452,904
Latest member
CodeMasterX

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top