Need Help on VBA Code with GoalSeek

phishhead1183

New member
Joined
Aug 6, 2014
Messages
2
Reaction score
0
Points
0
I'm having difficulty integrating two nearly-identical codes into one with Visual Basic Editor. Here is the coding that is leading me to trouble.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Row = 51 And Target.Column = 4 _
Then
Range("H47").GoalSeek Goal:=Range("D51").Value, _
ChangingCell:=Range("D37")
End If
If Target.Row = 52 And Target.Column = 4 _
Then
Range("H50").GoalSeek Goal:=Range("D5").Value, _
ChangingCell:=Range("D42")
End If
End Sub


Any guidance is much appreciated!
 
Is your question about GoalSeek or about the Worksheet_Change procedure?

This code should be located in the sheet's module, not an ordinary inserted module of the VBE.
 
Is your question about GoalSeek or about the Worksheet_Change procedure?

This code should be located in the sheet's module, not an ordinary inserted module of the VBE.

I found the answer on another thread, but thanks for your quick reply!
 
Back
Top