T
TotallyConfused
Please help. I have been trying to find a way to mask the date fields in my
userform. (there are many) But can seem to find something that works for
one reason or another. Searching through some forums I found this that I
found would be good and easy but somehow I messed it up. What I want it to
do is when form opens my date fields (testing with textbox64 except my
txtformdate is exempt from this) should be greyed out as mm/dd/yyyy. When
user enters date the date is then changed to black color font. If it is not
a date, then it would displaye Msg Box Data entered is not a date Please try
again. What I have below is not working. Can someone please help. Thank
you in advance.
Private Sub TextBox64_Click(ByVal Cancel As MSForms.ReturnBoolean)
With UserForm2.TextBox64
.Text = ""
.ForeColor = RGB(0, 0, 51)
With UserForm2.TextBox64
If Not IsDate(UserForm2.TextBox64.Text) Then
MsgBox """The Data entered is not a Date""" _
& Chr(10) & " ""Please Try again"""
Exit Sub
End If
End With
End Sub
Private Sub UserForm_Initialize()
Me.txtFormDate = Date
'Me.FormDate = format(Date,"mm-dd-yyyy")
With Me.TextBox64
.Text = "dd/mm/yy"
.ForeColor = RGB(204, 204, 204)
.Font.Size = 10
End With
End Sub
userform. (there are many) But can seem to find something that works for
one reason or another. Searching through some forums I found this that I
found would be good and easy but somehow I messed it up. What I want it to
do is when form opens my date fields (testing with textbox64 except my
txtformdate is exempt from this) should be greyed out as mm/dd/yyyy. When
user enters date the date is then changed to black color font. If it is not
a date, then it would displaye Msg Box Data entered is not a date Please try
again. What I have below is not working. Can someone please help. Thank
you in advance.
Private Sub TextBox64_Click(ByVal Cancel As MSForms.ReturnBoolean)
With UserForm2.TextBox64
.Text = ""
.ForeColor = RGB(0, 0, 51)
With UserForm2.TextBox64
If Not IsDate(UserForm2.TextBox64.Text) Then
MsgBox """The Data entered is not a Date""" _
& Chr(10) & " ""Please Try again"""
Exit Sub
End If
End With
End Sub
Private Sub UserForm_Initialize()
Me.txtFormDate = Date
'Me.FormDate = format(Date,"mm-dd-yyyy")
With Me.TextBox64
.Text = "dd/mm/yy"
.ForeColor = RGB(204, 204, 204)
.Font.Size = 10
End With
End Sub