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
 

Some videos you may like

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

hureechunder

New Member
Joined
Sep 13, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
  2. Web
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,928
Messages
5,621,635
Members
415,849
Latest member
PhoenixRising2015

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
Top