Re: [AMPL 24588] AMPL Direct Spreadsheet Interface: Iteration problem

This is the VBA code

Option Explicit

Sub runPSA()

Dim i As Integer
Dim N As Integer

N = 10

Range(“Parameters!PSA”).Value = 2
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

For i = 1 To N
Application.StatusBar = “Reached iteration” & i

Sheets(“PSA results”).Cells(i + 5, 1).Value2 = i
Sheets(“PSA results”).Range(“B5:BB5”).Offset(i, 0).Value2 = Sheets(“PSA results”).Range(“B5:BB5”).Value2

Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.StatusBar = False
Range(“Parameters!PSA”).Value = 1

End Sub

It allows only to plot the iterations on the results sheets but it I cannot see any results reflecting in the values after I run the PSA.

Kindly help