Check Input, into Input box question

L

Les Stout

Hello all, i have an input box(code below) and i have 3 entries, is
there a way that i can check that each entry made in the input box is in
actual fact in the date format 26/07/07 ??

Private Sub Workbook_Open()
'
Dim strDates As String, s As Variant

strDates = Application.InputBox("Enter the ""from"" ""to"" dates and
the" & vbCrLf & _
"date paid, each date seperated by a
"",""..", "SALARY PERIOD")
If strDates = False Then
End
Else
s = Split(strDates, ",")
Range("B11").Value = s(0)
Range("D11").Value = s(1)
Range("B21").Value = s(2)
PrintSlip
End If

End Sub


Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
M

merjet

A partial solution is to declare a date variable and test the input
values with it, e.g.
Dim dt1 as Date
dt1 = s(0)

If the input value isn't a date, a type mismatch will result.

Hth,
Merjet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top