View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
salgud salgud is offline
external usenet poster
 
Posts: 219
Default Days in a month?

On Wed, 30 Jul 2008 10:45:01 -0700, J Sedoff wrote:

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


Helps a lot! Thanks.