ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check Input, into Input box question (https://www.excelbanter.com/excel-programming/391792-check-input-into-input-box-question.html)

Les Stout[_2_]

Check Input, into Input box question
 
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 ***

merjet

Check Input, into Input box question
 
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



Les Stout[_2_]

Check Input, into Input box question
 
Thanks merjet, will try... :0)

Best regards,

Les Stout

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


All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com