Hello

I have written this macro to loop solver multiple times. The problem is that it eats up about 5mb of ram every loop so after a few hundred it gets incredibly slow.

Does anybody have any ideas why this might be happening. My macro is below.

Thanks

' MixMod Macro
' Run everything
'
' Ueyboard Shortcut: Ctrl+Shift+R
   Sheets("Mixmod").Select
    Dim wb As Workbook

 '// If SOLVER is not loaded
If Not AddIns("Solver Add-In").Installed Then
     '// And it exists in the default directory
    If Dir(Application.LibraryPath & ("\SOLVER\SOLVER.XLAM")) <> vbNullString Then
         '// Load it
        AddIns("Solver Add-In").Installed = True
    Else
        MsgBox "SOLVER Add-in not found...", vbExclamation
    End If
    

    
   Application.ScreenUpdating = False
    Application.CutCopyMode = False
    
            End If
    
    Dim i As Long
    For i = 1 To Range("W10")
    
    Application.run "'Simons MIXMODS with monte carlo v1.0.xlsm'!run"

    
    Next
End Sub



Sub run()
'
' run Macro
' run solver
'
' Ueyboard Shortcut: Ctrl+n
'
Application.ScreenUpdating = False
Range("b4:t13").Value = Range("b4:t13").Value
SolverReset
SolverOptions precision:=0.001
SolverOk SetCell:="$W$20", MaxMinVal:=2, ValueOf:=0, ByChange:=Range("$B$23")
SolverAdd CellRef:="$B26:K26", relation:=1, FormulaText:=1
SolverAdd CellRef:="$B26:K26", relation:=3, FormulaText:=0
SolverAdd CellRef:="$L26", relation:=2, FormulaText:=1
SolverSolve UserFinish:=True
SolverFinish KeepFinal:=1, ReportArray:=Array(1)
Range("M26").Value = Worksheets("Answer Report 1").Range("E16").Value
Application.DisplayAlerts = False
Worksheets("Answer Report 1").Delete
Range("b27:n27").Value = Range("b26:n26").Value
    Range("B27:N27").Select
    Application.CutCopyMode = False
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("U4:U13").Select
    Selection.AUTOFILL Destination:=Range("B4:U13"), Type:=xlFillDefault
    Range("B4:T13").Select
    
     
     End Sub