help msgbox appear when sheet is inactive

akforsyt

New Member
Joined
Apr 9, 2009
Messages
18
I need some help. Everyone who has posted in these Forums has been incredibly helpful so far. I wasn't able to find any information on this one however.

I have a sheet that alerts me with a message box when a set time has passed. This works fine as long as I have this sheet active. I would also like to get the same alert when I have a different sheet selected.

For example, in Sheet 1, cell A1 I have entered 12:00. If I am on Sheet 1 and it is after 12:00 I get a message box. However, if I am on Sheet 2, the alert never pops up.

Is it possible to have the message box pop up no matter which sheet I am on?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
This is the part of the code I am dealing with .....
Cell AZ1 has the current time
Cell F3 has the input time


With Worksheets("Testing Schedule")
If Not IsEmpty(Range("F3")) Then
If Range("F3") <= Range("AZ1") Then
MsgBox "Stop", vbOKOnly + vbExclamation
End If
End If
End With

When I am on the Testing Schedule sheet this works fine. When I am on another sheet it does not. This code is in a module.
 
Upvote 0
Try qualifying the ranges

Rich (BB code):
With Worksheets("Testing Schedule")
    If Not IsEmpty(.Range("F3")) Then
        If .Range("F3") <= .Range("AZ1") Then
            MsgBox "Stop", vbOKOnly + vbExclamation
        End If
    End If
End With
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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