View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
J Sedoff[_2_] J Sedoff[_2_] is offline
external usenet poster
 
Posts: 26
Default Days in a month?

If you take the value of each cell that contains a date, whether or not it
truly is a correct date, and try to add 1 to it, you'll get an error if it is
not a date. Therefore, you just need an error catch, such as:

Sub checkDate()
..previous code...

On Error GoTo thisError

myDate = DateAdd("d", 1, ActiveCell.Value)
MsgBox myDate

...rest of code...
Exit Sub

thisError:
MsgBox "Error"
End Sub

Hope this helps, Jim