isdate() will return a true/false
so
if not isdate(range("A1")) then Msgbox("NOT A DATE VALUE")
Just learnt this tick write some code that will run
vb on a cell change
so in the
vb part of that worksheet (not a Module) took me an 1/2 to work this out didn't read the help right LOL
Private Sub Worksheet_Change(ByVal Target As Range)
Dim checkdate as Boolean
select case Target.address
case "$A$1" ' a1 was change
checkdate = isdate(Target.Value) if its not a date value it will be false
if not checkdate then
Msgbox("this is not a date value")
else
call sub_go_do_something(Target.Value)
End if
case else
end select
End sub
now this can be in a module
sub_go_do_something(thisvalue)
msgbox("You inputed " & format(thisvalue,"mm/dd/yy") & " Date")
End sub