message box based on cell value of any tab selected

Watchdawg

Board Regular
Joined
Jan 21, 2015
Messages
84
OK, I've looked around and seen some ideas on what I'm looking for, but nothing has panned out.
I have a workbook with quite a few tabs on it. In cell C64 is a number from 0.0 to 10 on each page. When selecting any tab, if that particular cell is 0.0 value, then I want a message box to pop up and the focus to be set to that cell.
I've done this in a worksheet_change sub, but I'm failing miserably for some reason.

Does anyone have any ideas? I was trying to do something as simple as :

VBA Code:
Private Sub Worksheet_Change()
If Range("C64").Value = 0.0 Then
    MsgBox "This employee has no points"
End if
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
The "Worksheet_Change" event only fires when a cell on a sheet is physically changed.
If you want this to run when a sheet is activated, put this code in the "ThisWorkbook" module of your workbook:
VBA Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Range("C64").Value = 0 Then
    MsgBox "This employee has no points"
End If
End Sub
 
Upvote 0
Solution
The "Worksheet_Change" event only fires when a cell on a sheet is physically changed.
If you want this to run when a sheet is activated, put this code in the "ThisWorkbook" module of your workbook:
VBA Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
If Range("C64").Value = 0 Then
    MsgBox "This employee has no points"
End If
End Sub
Perfect! Thank you so much!
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,214
Members
449,074
Latest member
cancansova

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