insufficient memory

hugobos

New Member
Joined
Dec 20, 2017
Messages
2
I need to run (a variant of) this module a few hundred times.
After a few times (2 to 5) I get an error "insufficient memory".

Anybody any idea how to fix this?


Code:
Sub testertje()


Dim WBmodel As Workbook
Dim WSscan As Worksheet
Dim pad As String


pad = "G:\PM\1_16_Monitoren\05_Terugkerende_rapportering\22_Teamscan\winterversie\"


Workbooks.Open Filename:=pad & "modelteam.xlsm"


Set WBmodel = ActiveWorkbook
Set WSscan = WBmodel.Sheets("modelscan")


WSscan.Copy After:=Sheets(1)
Sheets("modelscan (2)").Name = "Boschmans"


WBmodel.SaveAs (pad & "vanuyts_desmet.xlsm")


WBmodel.Close savechanges:=False


Set WSscan = Nothing
Set WBmodel = Nothing


End Sub

I have excel 2010 and installed office 64bits
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
hugobos,

Welcome to the MrExcel forum.

In a copy of your workbook, try adding the BOLD line of code:

Rich (BB code):
Set WBmodel = Nothing

Application.CutCopyMode = False

End Sub
 
Last edited:
Upvote 0
hugobos,

Thanks for the feedback.

You are very welcome. Glad I could help.

And, come back anytime.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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