Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK 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
Aug 11, 2009
1
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
 
Replies continue below

Recommended for you

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor