InputBox
Hi Art
Try
Sub test()
Dim S As String
Dim Dt As Date
Do
S = InputBox("Enter a date:", "Art sez:", S)
If S = "" Then Exit Sub
On Error Resume Next
Dt = DateValue(S)
Loop Until Year(Dt) 1995
MsgBox "You wrote " & Format$(Dt, "dddd mmmm dd. yyyy")
End Sub
It allows all common date formats, e.g. jun 1 and 12/03/04. No specified
year means "this year".
HTH. Best wishes Harald
"ArthurJ" skrev i melding
...
Using the InputBox (either Excel's method or VBA's function), I'd like the
user to specify a date. But how can I tell if the user has clicked cancel?
Second question: the Excel InputBox allows me to specify the data type.
That's good. But it isn't quite narrow enough (merely 'number' rather than
'date'). Is there a way I can tighten up the data type to 'date'?
Art
|