ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Min and Max value in TextBox (https://www.excelbanter.com/excel-programming/357846-min-max-value-textbox.html)

Abdul[_2_]

Min and Max value in TextBox
 
Is there a way to accept only 2003 to current year in a text box?

(2003,2004,2005,2006 only now and in next year upto 2007)

Thanks


Toppers

Min and Max value in TextBox
 
One way:

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If CInt(TextBox1.Value) < 2003 Or CInt(TextBox1.Value) Year(Now()) Then
MsgBox "Invalid year"
End If
End Sub

"Abdul" wrote:

Is there a way to accept only 2003 to current year in a text box?

(2003,2004,2005,2006 only now and in next year upto 2007)

Thanks




All times are GMT +1. The time now is 07:23 AM.

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