Run a macro when a cell changes on a different tab?

cjcobra

Board Regular
Joined
Apr 9, 2002
Messages
193
In sheet3, I have:

Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Cells(1, 1)
If Target = Cells(47, 2) Then
MessageBoxMania
End If
End Sub

And in my main module I have:

Sub MessageBoxMania()
Dim Resp As Integer
Resp = MsgBox("message", 4, "Please confirm")
If Resp = 6 Then
'macro
Else
End If
End Sub

So if Cell(47,2)=1, it runs the macro perfectly, but ONLY if I am on sheet3. If I am on another sheet, and the value of Cell(47,2) changes to 1, the macro will not run. Eventually, I would like it to work like this:

While on some other sheet. Value on sheet3 changes. Save current position. Go to sheet3 and run macro. Return to previous position. Sounds complicated, but I almost have everything.
Thanks!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Cells(1, 1)
If Target = Cells(47, 2) Then
MessageBoxMania
End If
End Sub
Try this instead:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Set Target = Cells(1, 1)
If Target = Cells(47, 2) Then
call MessageBoxMania
End If
End Sub


_________________
Hope this helps.
Kind regards, Al.
This message was edited by Al Chara on 2002-04-11 13:22
 
Upvote 0

Forum statistics

Threads
1,213,560
Messages
6,114,304
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top