Thread: date format
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default date format

How about

With Activesheet.Range("B8")
If .Value < "" Then
If Not IsDate(.Value) Then
MsgBox "Please enter a date in cell B8.", , "Warning!"
EndIf
Else
MsgBox "Please enter a date in cell B8.", , "Warning!"
End If
End With

--

HTH

RP
(remove nothere from the email address if mailing direct)


"AccessHelp" wrote in message
...
I have a cell where people type in a date. The format is "mm/dd/yyyy"

(e.g.
11/18/2005). I want to write a "If" statement to check whether the user
types in a date in that cell. If they leave it blank or type anything

else,
I want to have a message box comes up. So this is what I have, and it's

not
working.

If ActiveSheet.Range("B8").NumberFormat < "m/d/yyyy" Then
MsgBox "Please enter a date in cell B8.", , "Warning!"

Please help. Thanks.