Pop-up message if specific cells contain value

gato88

New Member
Joined
Feb 10, 2014
Messages
25
Hi there

I would like to generate a pop-up message "Warning! Please check value!" if any of the following cells A4, D5, G7 contain any character.

Thank you in advance!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Haven't tested but try this:

If range("A4").value <>"" or range("D5").value <>"" or range("G7").value <>"" then
MsgBox("Warning! Please check value!")
End if

One way or another this is what you appear to be seeking.
 
Upvote 0
GO TO VBA EDITOR

SELECT THE DESIRED SHEET & PASTE THE FOLLOWING CODE

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("A4,D5,G7").Value <> "" Then MsgBox ("Warning! Please check value!")


End Sub
 
Upvote 0
GO TO VBA EDITOR

SELECT THE DESIRED SHEET & PASTE THE FOLLOWING CODE

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Range("A4,D5,G7").Value <> "" Then MsgBox ("Warning! Please check value!")


End Sub


Is it possible for the warning to appear only once after text is input in any of these 3 cells.
Once I click "OK" and proceed to input a value in any other cell on the worksheet, the warning still pops up on screen. I woud like the warning to only appear once.
 
Upvote 0
Hi I tried this code and it seems to be doing what I want.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A4,D5,G7")) Is Nothing Then Exit Sub
If Target.Value <> "" Then MsgBox "Please check value!", vbExclamation
End Sub


However, if the user deletes a value from any of the target cells, I get a runtime error (as per below)

Error 13: Type mismatch highlighting the following line
If Target.Value <> "" Then
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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