Out of memory issue in VBA

hureechunder

New Member
Joined
Sep 13, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
  2. Web
This problem has been driving me insane...so thanks in advance for your help!

I have an excel workbook with a single sheet visible (the rest are hidden), and two user forms as under.
When I hit F5, I can run cmdButton1 with no problems. However, running cmdExit gives me an 'Out of Memory' error. I get exactly two 'Out of Memory' prompts one after the other, corresponding to the number of subroutines.
As a test case, I removed the 'Userform2.Show' line under cmdButton1_Click, and that also gave me an 'Out of Memory' error when running.
Is there a rule that prevents all user forms to be unloaded at the same time?

Private Sub cmdButton1_Click()
Me.Hide
UserForm2.Show
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdButton1_Click()
Me.Hide
UserForm2.Show
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
I can't seem to edit the post above - just pointing out that the code has accidentally got copied twice above. It's just 2 subroutines, not 4.
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,244
Members
448,879
Latest member
VanGirl

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