First off, thanks to everyone ahead of time for helping me with this. I need help with a Do While loop that I am creating. First, let me give the background on what I am trying to accomplish.
I need a loop that will look at a budget and continue to loop until that available (or remaining) budget is gone. In doing so, this loop will need to find the greatest index in a range of cells and then add "1" to the number in the cell directly to the right of it. I have staged out an example of the first three steps manually in the attached excel file.
Below is the code that I have written so far:
__________________________________________________
Sub Model_Run()
Application.ScreenUpdating = False
Range("H3:H12").Formula = 1
Dim budget_monitor As Integer
budget_monitor = Cells(18, 6)
Do While budget_monitor >= 0.01
If budget_monitor = 0 Then
Exit Do
Else
End If
Loop
Application.ScreenUpdating = True
End Sub
_______________________________________________
First, the command to set all cells in the range "purchase" to "1" is important. All items must be bought, what is trying to be solved here is finding the most cost efficient combination given the item's cost and associated quantities. Second, there is a cell that has been written to keep track of the remaining budget. In the non example file I have going, that cell is "F18".
Feel absolutely free to rewrite any code that I have already written if there is a better way to do. I am trying to learn as I go with VBA.
Again, ANY and all help is very greatly appreciated. I look forward to hearing back from you all!
Bookmarks