![]() |
data input format
Hi
I have a user entry form and need to ensure the correct data format is used when entering. At the moment it is a text box on a VBA data entry form, I want to code the text box to only accept dd/mm/yy format. -- thanks Roy |
data input format
If you get the dat as a string, then you can perform very specific tests on
parts of that string. For example: Sub StrictFormat() Dim s As String, i As Integer s = Application.InputBox(prompt:="Date?", Type:=2) If Len(s) < 8 Then MsgBox "Bad Format" Exit Sub End If ary = Split(s, "/") If UBound(ary) < 2 Then MsgBox "Bad Format" Exit Sub End If i = ary(0) If i 31 Then MsgBox "Bad Format" Exit Sub End If i = ary(1) If i 12 Then MsgBox "Bad Format" Exit Sub End If End Sub -- Gary''s Student - gsnu201001 "Roy Gudgeon" wrote: Hi I have a user entry form and need to ensure the correct data format is used when entering. At the moment it is a text box on a VBA data entry form, I want to code the text box to only accept dd/mm/yy format. -- thanks Roy |
All times are GMT +1. The time now is 09:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com