A
Arnold Klapheck
I have users entering info into a worksheet then they click a button to start
the below code. The problem I am having is if they leave it blank I am
getting the format error message instead of the date format error message. I
have the cell formatted as short date I put the cell into a date variable
(mydate) then use mydate in the below code. Even when I put in the date in
correct format I seem to be getting the format error message. Any
help would be appreciated.
If mydate = "" Then
x = MsgBox("blank error message", vbCritical, "Error")
Range("PeriodFrom").Select
Range("PeriodFrom").Activate
End
Exit Sub
Handler:
Select Case Err.Number
Case 13 'data type mismatch
x = MsgBox("Date format error message",
vbCritical, "Error")
Range("PeriodFrom").Select
Range("PeriodFrom").Activate
End
the below code. The problem I am having is if they leave it blank I am
getting the format error message instead of the date format error message. I
have the cell formatted as short date I put the cell into a date variable
(mydate) then use mydate in the below code. Even when I put in the date in
correct format I seem to be getting the format error message. Any
help would be appreciated.
If mydate = "" Then
x = MsgBox("blank error message", vbCritical, "Error")
Range("PeriodFrom").Select
Range("PeriodFrom").Activate
End
Exit Sub
Handler:
Select Case Err.Number
Case 13 'data type mismatch
x = MsgBox("Date format error message",
vbCritical, "Error")
Range("PeriodFrom").Select
Range("PeriodFrom").Activate
End