Macro needed: pop up messaged when specific cell left blank

akash.scap

New Member
Joined
Feb 8, 2011
Messages
20
Hello....I'm looking for a macro pop up messag when a specific cell us left blank. If A1 is left blank then pop up message should come up for say 2 or 3 seconds and go away automatically..please help. Thank you
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Create a userform with one large label on it, then right-click the form and select View Code, and put this in the code window:-
Code:
[FONT=Fixedsys]Option Explicit[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]Private Sub UserForm_Activate()[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]  Dim dtStart As Date[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]  dtStart = Now()[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]  Do Until Now() > dtStart + TimeValue("00:00:03")[/FONT]
[FONT=Fixedsys]    DoEvents[/FONT]
[FONT=Fixedsys]  Loop[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]  Unload Me[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]End Sub[/FONT]
Set the time value to the length you want the form to be displayed.

Right-click the worksheet tab where you want the check on cell A1 and select View Code, then put this in the code window:-
Code:
[FONT=Fixedsys]Option Explicit[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]Private Sub Worksheet_Change(ByVal Target As Range)[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]  If IsEmpty(Range("A1")) Then Call A1_Warning[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]End Sub[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]Private Sub Worksheet_Calculate()[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]  If IsEmpty(Range("A1")) Then Call A1_Warning[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]End Sub[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]Private Sub A1_Warning()[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]  UserForm1.Label1.Caption = "Warning: A1 is empty!"[/FONT]
[FONT=Fixedsys]  UserForm1.Show[/FONT]
[FONT=Fixedsys] [/FONT]
[FONT=Fixedsys]End Sub[/FONT]
Change the name of the userform and the label if you use different names for them.

Now go to your worksheet and test it works okay.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

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