GalileoG
Structural
- Feb 17, 2007
- 467
Hi all,
I have the following VBA code which performs a goal seek whenever a value has changed in my spreadsheet. However, what I would like to do is set value BK39 to equal 1.0 PRIOR to performing the goal seek (in order for goal seek to determine the smallest root for my equation). What would I need to add to this code? Thank you!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim bSuccess As Boolean
On Error Resume Next
bSuccess = Range("BH39").GoalSeek(0, Range("BK39"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""BK39""!"
End If
End Sub
Clansman
If a builder has built a house for a man and has not made his work sound, and the house which he has built has fallen down and so caused the death of the householder, that builder shall be put to death." Code of Hammurabi, c.2040 B.C.
I have the following VBA code which performs a goal seek whenever a value has changed in my spreadsheet. However, what I would like to do is set value BK39 to equal 1.0 PRIOR to performing the goal seek (in order for goal seek to determine the smallest root for my equation). What would I need to add to this code? Thank you!
Private Sub Worksheet_Change(ByVal Target As Range)
Dim bSuccess As Boolean
On Error Resume Next
bSuccess = Range("BH39").GoalSeek(0, Range("BK39"))
On Error GoTo 0
If Not bSuccess Then
MsgBox "Goal Seek Failed for Cell ""BK39""!"
End If
End Sub
Clansman
If a builder has built a house for a man and has not made his work sound, and the house which he has built has fallen down and so caused the death of the householder, that builder shall be put to death." Code of Hammurabi, c.2040 B.C.