here's my situation:
i have a vb macro that calls solver to populate its target cell ("Required"
. however, if there is data in another cell ("Lump"
, then i don't want solver to act, and i want a simple formula to be placed in Required instead.
i've written a simple "if..then" to check for data in Lump, but for some reason it finds data there whether or not there actually is any. here is my code (Required is F7):
i've also tried the If statement as
but that doesn't work either. neither statements will allow solver to act whether the Lump cell is empty or 0. if Lump contains a number, it works as expected (with the exception that the Required cell is completely black no matter what colors i set for it)
so basically it comes down to this: if the Lump cell is empty or 0, i want solver to act. if it contains a number (other than 0), i want to place a formula in the Required cell and solver will not act.
any ideas?
i have a vb macro that calls solver to populate its target cell ("Required"


i've written a simple "if..then" to check for data in Lump, but for some reason it finds data there whether or not there actually is any. here is my code (Required is F7):
Code:
LastYear = 20 + Range("Years").Value
If Range("Lump").Value = "" Then
SolverOk SetCell:="$E" & LastYear, MaxMinVal:=3, ValueOf:="0", ByChange:="$F$7"
SolverSolve (True)
Else
Range("Required").Value = "=C11/C5"
End If
Code:
If Range("Lump").Value = 0 Then
but that doesn't work either. neither statements will allow solver to act whether the Lump cell is empty or 0. if Lump contains a number, it works as expected (with the exception that the Required cell is completely black no matter what colors i set for it)
so basically it comes down to this: if the Lump cell is empty or 0, i want solver to act. if it contains a number (other than 0), i want to place a formula in the Required cell and solver will not act.
any ideas?