Date ofbirth between 01/01/1995 to 01/01/2005

Solved/Closed
AKS - Aug 19, 2010 at 07:33 AM
 AKS - Sep 9, 2010 at 03:41 AM
Hello,

I have a userform with a text box name txtdob.
i m trying to do if i add a date in text box between 01/01/1995 to 01/01/2005 then msgbox show "Eligible" and sheet1 collumn A2 "Eligible"
and if date is Before 01/01/1995 then msgbox show " UnEligible " and sheet1 collumn A2" UnEligible " & After 01/01/2005 then msgbox show " Uneligible" and sheet1 collumn A2" UnEligible "
please help me

1 reply

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Aug 20, 2010 at 08:50 AM
Could you please upload a sample EXCEL file WITH sample data, macro, formula , conditional formatting etc on some shared site like https://authentification.site , http://docs.google.com, http://wikisend.com/ , http://www.editgrid.com etc
A N D post back here the link to allow better understanding of how it is now and how you foresee. Based on the sample book, could you re-explain your problem too
0
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Aug 23, 2010 at 08:51 AM
You can use this


If ((Format(DATEOFBIRTH, "yyyymmdd") < "199500101") _
        Or (Format(DATEOFBIRTH, "yyyymmdd") > "200500101")) Then
        MsgBox ("Ineligible")
        
    Else
    
        MsgBox ("Eligible")
End if


Just a side note, it is "Ineligible" not "Uneligible" and you should spell "Temperory" as "Temporary"
0
thanks it solve my problem
there is another problems i have piease solve it
1- how to set numeric value in text box.
2- in user form i have 02 text boxes with numeric value for example first text box have "81 cm " and second have text box "86 cm" it means in these text boxes i want minimum gap "6 cm" and if these text box have "81" or "85" msgbox Ineligible.
0
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
769
Aug 25, 2010 at 08:27 AM
for #1
you can test the value if it is numeric or not. The function is "IsNumeric"

for #2
"18 cm" is not numeric. "18" is. So if you have entered "18 cm", then its a text.
You can test if as DOB was tested. Only thing, in this case there does not seem to be any reason to format the numbers
0
thnx it solve my problem
and no. 2 problem is i says 18 cm but it is only for example
i want if text box 2 text count text box 1 no +6 (any 1 to 999)
like if text box1 have 01 then text box2 count +6 if it is +6 then Ok
if text box1 have 10 then text box2 count +6 if it is +6 then Ok
if text box1 have 99 then text box2 count +6 if it is +6 then Ok and
if text box1 have 01 then text box2 count is not +6 if it is not +6 then False

any no. a add in text box1 then text box 2 count it +6 and give me OK or False
0