View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bill[_19_] Bill[_19_] is offline
external usenet poster
 
Posts: 13
Default DateAdd function

Hello,
Can anybody tell me why the line of code in Capital letters beginning with CMONTHPLUS returns a "mismatch type" error? The variables above this line of code show the appropriate values when I am in the debugging mode. The execution of the macro stops at this line and says "mismatch type". Thanks in advance, Bill

Sub Button12_Click()
Sheet3.Activate
Dim Cmonth As Date
Dim Cmonthplus As Date
Dim thistime As Date
thistime = Date
Cmonth = Range("c7")
If Cmonth < thistime Then
CMONTHPLUS = DateAdd("yyyy", 2, "Cmonth")
Range("c7") = Cmonthplus
End If
End Sub