Hi,
I am using the code below to find value on the target cells and I want to set a condition that the target value obtained in cell (D66 )has to be (>= 0 ), same for ("D66"), ("D68") and ("D70").
1- How can I do that ? and how to add multiple constrains?
2- and is it OK to use Goal Seek function to solve the value in one cell then use the calculated value into another cell where I set Goal Seek function as well so I can run multiple Goal seek to do kind of loop to solve 2, 3, 4, 5 or even 6 equations
in different cells with different conditions and they might be related to each other in some how?
the code is:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim bSuccess As Boolean
On Error Resume Next
bSuccess = Range("C66").GoalSeek(0, Range("D66"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""C7""!"
End If
On Error Resume Next
bSuccess = Range("C68").GoalSeek(0, Range("D68"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""DAfStb""!"
End If
On Error Resume Next
bSuccess = Range("C70").GoalSeek(0, Range("D70"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""EC2""!"
End If
On Error Resume Next
bSuccess = Range("C72").GoalSeek(0, Range("D72"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""DAfStb""!"
End If
On Error Resume Next
bSuccess = Range("C77").GoalSeek(0, Range("C38"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""DAfStb""!"
End If
On Error Resume Next
bSuccess = Range("C78").GoalSeek(0, Range("C37"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""DAfStb""!"
End If
End Sub