Range("B1").GoalSeek Goal:=10, ChangingCell:=Range("A1")
Have you used Goal Seek before? Data > What if Analysis > Goal Seek. Sounds like what you need, or if it must be a macro this is what a recorded Goal Seek looks like:
Code:Range("B1").GoalSeek Goal:=10, ChangingCell:=Range("A1")
B1 had formula =A1*5
a = 0
Do Until Range("A1").Value = 0
Range("B1").Value = a
If a = 5000 Then 'max number of iterations to prevent infinite loop
Range("B1").Value = ""
MsgBox "Max iterations reached. Cant find the result"
Exit Sub
End If
a = a + 1
Loop
Could you stop posting essentially the same question repeatedly, please.
Have you used Goal Seek before? Data > What if Analysis > Goal Seek. Sounds like what you need, or if it must be a macro this is what a recorded Goal Seek looks like:
Code:Range("B1").GoalSeek Goal:=10, ChangingCell:=Range("A1")
B1 had formula =A1*5
That's really not the point.
That is great! Do you know how to specify additional criteria for A1?
If Range("A1") = 'some scenarios' then
'goalseek code
End if