View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default 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