[This post was split from this thread]
I realize this thread has been dead for a couple of years, but I'm hoping you guys are still actively checking replies.....
This is my first macro, and I've followed all the responses in this thread so far, but how do you write a macro that references another worksheet?
my macro:
Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo TheEnd
If Not Intersect(Target, [a2,c4,a3]) Is Nothing Then
MsgBox "I'm running"
Application.EnableEvents = False
Range("C7").GoalSeek Goal:=0.0001, ChangingCell:=Range("C16")
End If
TheEnd:
Application.EnableEvents = True
End Sub
What if the precedents (a2 and a3) are in another worksheet, within the same Excel file?
Thanks in advance,
Shack
Edited by Von Pookie
NateO said:Hello Peter, change the target.address = "$c$2" to:
If Not Intersect(Target, [a1,c2,d3]) Is Nothing Then
Where a1 and d3 are precedents causing c2's calculated value to change.
I realize this thread has been dead for a couple of years, but I'm hoping you guys are still actively checking replies.....
This is my first macro, and I've followed all the responses in this thread so far, but how do you write a macro that references another worksheet?
my macro:
Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo TheEnd
If Not Intersect(Target, [a2,c4,a3]) Is Nothing Then
MsgBox "I'm running"
Application.EnableEvents = False
Range("C7").GoalSeek Goal:=0.0001, ChangingCell:=Range("C16")
End If
TheEnd:
Application.EnableEvents = True
End Sub
What if the precedents (a2 and a3) are in another worksheet, within the same Excel file?
Thanks in advance,
Shack
Edited by Von Pookie