Hi guys,
I'm pretty new to coding but I need it for a dissertation on auctions. Any help is greatly appreciated!!
A simplified version of what I am trying to achieve is to have a blank excel file with the number 10 in A1. I then want to run a Do Until loop with "A1 - 1" until it gets to zero, and post the result in cell B1. I can't do it with a counter as in my actual problem (second code) the value I need depends on when a solution changes. My attempt so far:
I know this is a very simplified version but it should fix the code below!
Thanks again,
Robbie
I'm pretty new to coding but I need it for a dissertation on auctions. Any help is greatly appreciated!!
A simplified version of what I am trying to achieve is to have a blank excel file with the number 10 in A1. I then want to run a Do Until loop with "A1 - 1" until it gets to zero, and post the result in cell B1. I can't do it with a counter as in my actual problem (second code) the value I need depends on when a solution changes. My attempt so far:
Code:
Sub Practiseloop()
Dim i As Integer
i = 0
Do Until Range("A1").Value = 0
A1 = A1 - (1 * i)
Debug.Print i
Loop
End Sub
I know this is a very simplified version but it should fix the code below!
Code:
Sub SuppFirstPriceOpenSolve()Dim i As Integer
i = 0
'keep going round the loop until the condition is true
Do Until Range("J24").Value = 0
I24 = I24 - (1000 * i)
Range("J2: J278").Value = 0
SolverReset
SolverAdd CellRef:="$J$2:$J$278", Relation:=1, FormulaText:="1"
SolverAdd CellRef:="$J$2:$J$278", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$L$2:$L$8", Relation:=1, FormulaText:="$M$2:$M$8"
SolverAdd CellRef:="$L$2:$L$8", Relation:=3, FormulaText:="0"
SolverAdd CellRef:="$O$2:$T$2", Relation:=1, FormulaText:="$O$6:$T$6"
SolverOk SetCell:="$O$8", MaxMinVal:=1, ValueOf:=0, ByChange:="$J$2:$J$278"
SolverAdd CellRef:="$J$2:$J$278", Relation:=4, FormulaText:="integer"
RunOpenSolver
Debug.Print i
Loop
End Sub
Robbie