DrummerAndy
New Member
- Joined
- Aug 22, 2011
- Messages
- 14
Hello,
We use Excel to organize our testing enhancements. When we first open the template, a form displays to enter information regarding the enhancement including the Begin and End dates.
I would like to code the text boxes where the dates are entered to check whether or not each date is a state holiday and return an error message if it is.
I already have the following code to validate that the value entered is a date in the first place.
Finally, I have a sheet in the workbook called "State Holidays" where I have 28 holidays listed (14 for last year and 14 for this year) in chronological order using their numeric value (ie. 40910 for 1/2/2012) in Column C. I have also named those cells 'Holidays' in Excel.
I hope this is enough information for someone to help me.
Thanks in advance!
We use Excel to organize our testing enhancements. When we first open the template, a form displays to enter information regarding the enhancement including the Begin and End dates.
I would like to code the text boxes where the dates are entered to check whether or not each date is a state holiday and return an error message if it is.
I already have the following code to validate that the value entered is a date in the first place.
Code:
Private Sub txtSTB_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtSTB.BackColor = &HFFFFFF
With txtSTB
If IsDate(.Value) Then
.Value = Format$(.Value, "mm/dd/yyyy")
Else
txtSTB.BackColor = &HFF
MsgBox "The System Test Begin Date is not valid."
.SelStart = 0
.SelLength = Len(.Text)
Cancel = True
End If
End With
End Sub
Finally, I have a sheet in the workbook called "State Holidays" where I have 28 holidays listed (14 for last year and 14 for this year) in chronological order using their numeric value (ie. 40910 for 1/2/2012) in Column C. I have also named those cells 'Holidays' in Excel.
I hope this is enough information for someone to help me.
Thanks in advance!