Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Specific cell date value to trigger msg box

  Asked By: Phil    Date: Mar 03    Category: MS Office    Views: 1178
  

Just 4 fun, I would like a msg box to appear when a certain date is
entered anywhere in the sheet.
I have tried some events (sheetchange, active cell change), but don't
know enough to pin down exactly what I need.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Luisa Fischer     Answered On: Mar 03

You probably want something like this. This code will check all the
cells on the worksheet whenever the Change event is triggered. If
your sample text is found, it will tell you the cell. I didn't test
this but hopefully it will help.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim rng As Range
On Error Resume Next
Set rng = Cells
If Not Intersect(Target, rng) Is Nothing Then
Set MyCell = Cells.Find(What:="11/21/2006", After:=Range
("A1"), LookIn:=xlValues, LookAt:=xlWhole, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:=True)
On Error Goto 0
MsgBox MyCell.Address & " contains what you're looking
for."
End If
Set rng = Nothing
End Sub

 
Didn't find what you were looking for? Find more on Specific cell date value to trigger msg box Or get search suggestion and latest updates.




Tagged: