Handling dates in VBA
Hi Sune
Your problem is due to excel using american dates, you can fix this by
using the CDate function which is demonstrated below, if you need any
more info try searching for post on CDate by Tom Ogilvy he must have
around a million posts on this by now...
example code
Option Explicit
Dim UpperDate, LowerDate As Date
Private Sub CommandButton1_Click()
LowerDate = [a1].Value
UpperDate = [a2].Value
LowerDate = CDate(LowerDate)
UpperDate = CDate(UpperDate)
MsgBox LowerDate & vbNewLine & UpperDate
End Sub
hope this helps
|