Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

vba loop

  Asked By: Ketan    Date: Jan 21    Category: MS Office    Views: 855
  

I tried a method to automate solver using a macro to calculate a
result for each of 97 rows. it only calculates the 1st two rows. can
someone point out what is wrong please? i tried two different ways,
but neither work - clearly i have no idea what i am doing!

Sub Macro10()
Dim i As Long
For i = 3 To 100
SolverOk SetCell:=Cells(i, 61).Address, MaxMinVal:=2, ValueOf:="0",
ByChange:=Cells(i, 49).Address
Next i
SolverSolve UserFinish:=True
End Sub

Sub Macro11()
'
' Macro11 Macro
' Macro recorded 5/23/2006 by .
'
Dim i As Long
Do While i < 15
SolverOk SetCell:=Cells(i, 61).Address, MaxMinVal:=2, ValueOf:="0",
ByChange:=Cells(i, 49).Address
SolverSolve UserFinish:=True
i = i + 1
Loop
'
End Sub

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Jeanette Greene     Answered On: Jan 21

Are you sure there are formulae in column BI below the first two rows?

Also not that in Macro11 you should initialise i to greater than 0 as
there is no row 0 on a spreadsheet.

 
Answer #2    Answered By: Isabella Campbell     Answered On: Jan 21

i am pretty much perfect with excel front end but i am eagerly looking
forward to learn vba  but i dont have any knowledge abt it. can any one send the
basics vba please.

 
Didn't find what you were looking for? Find more on vba loop Or get search suggestion and latest updates.




Tagged: