Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

why don't these loops work?

Status
Not open for further replies.

anon125

Computer
Joined
Aug 11, 2009
Messages
1
Location
CA
Sub zerotest()
Dim seekValue As Double
Dim changeCell As Range
Inflation = Range("O7").Value
seekValue = 12345
'seekValue = InputBox("What's the value to seek?")
For Each changeCell In Range("N14:N32").Cells
'Do Until changeCell < 10
changeCell.GoalSeek Goal:=seekValue, changingCell:=changeCell.Offset(0, -4)
'Do Until changeCell < 10
' Loop
seekValue = seekValue + (seekValue * Inflation)
' Loop
Next changeCell
End Sub
yes i know they are commented out.
but how do i limit the value to 10 or more?
thanks
 
Why don't you use a for loop? something like :

For changeCell = 1 To 10
changeCell.GoalSeek Goal:=seekValue, changingCell:=changeCell.Offset(0, -4)
seekValue = seekValue + (seekValue * Inflation)
End For

Cyril Guichard
Defense Program Manager
Belgium
 
What you have put in your code

Do Until changeCell < 10

is saying do the code until the value of changeCell is less than 10.

Try

Do Until changeCell > 10
 
Or
Code:
do while changeCell < 10
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top