A TEXT can never be lesser than a number. At least in the Excel world. Santhosh, please replace the entire code in form1 with this
Private Sub CommandButton1_Click() If CDate(TextBox1.Value) > Date Then msg = MsgBox("You cannot make a transaction for a future date", vbCritical, "Your Personal Banking") Exit Sub End If With Cells(Rows.Count, 1).End(xlUp)(2) .NumberFormat = "[$-409]d-mmm-yy;@" .Resize(1, 3).Value = Array(TextBox1.Value, TextBox2.Value, TextBox3.Value) End With End Sub Private Sub CommandButton2_Click() Unload UserForm1 End Sub Private Sub CommandButton3_Click() Userform2.Show End Sub Private Sub TextBox3_Change() Application.EnableEvents = 0 If Len(TextBox3.Text) = 1 Then If InStr(1, "0123456789", TextBox3.Text) = 0 Then TextBox3.Text = "" End If End If If Len(CStr(Val(TextBox3.Text))) <> Len(TextBox3.Text) Then TextBox3.Text = "" End If Application.EnableEvents = 1 End Sub Regards, Sam Mathai Chacko On Mon, Nov 28, 2011 at 6:47 PM, NOORAIN ANSARI <noorain.ans...@gmail.com>wrote: > Dear Santosh, > > Please see attached sheet i hope it will help to you. > > -- > Thanks & regards, > Noorain Ansari > *http://excelmacroworld.blogspot.com/*<http://excelmacroworld.blogspot.com/> > *http://noorain-ansari.blogspot.com/*<http://noorain-ansari.blogspot.com/> > > On Mon, Nov 28, 2011 at 3:00 PM, santosh subudhi < > santoshkumar.subu...@gmail.com> wrote: > >> Hi All, >> >> In the user form I have coded a date validation which should take data >> for current date or the previous date only with the help of *calendar >> only*. >> >> However, the code is not working properly. >> >> Moreover in the textbox3 I want it to restrict it only for numbers and no >> character should be allowed to be entered for which I need help. >> >> -- >> Regards >> Santosh >> santoshkumar.subu...@gmail.com >> >> -- >> FORUM RULES (934+ members already BANNED for violation) >> >> 1) Use concise, accurate thread titles. Poor thread titles, like Please >> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice >> will not get quick attention or may not be answered. >> >> 2) Don't post a question in the thread of another member. >> >> 3) Don't post questions regarding breaking or bypassing any security >> measure. >> >> 4) Acknowledge the responses you receive, good or bad. >> >> 5) Cross-promotion of, or links to, forums competitive to this forum in >> signatures are prohibited. >> >> NOTE : Don't ever post personal or confidential data in a workbook. Forum >> owners and members are not responsible for any loss. >> >> >> ------------------------------------------------------------------------------------------------------ >> To post to this group, send email to excel-macros@googlegroups.com >> > > > ** <http://noorain-ansari.blogspot.com/> > > -- > FORUM RULES (934+ members already BANNED for violation) > > 1) Use concise, accurate thread titles. Poor thread titles, like Please > Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice > will not get quick attention or may not be answered. > > 2) Don't post a question in the thread of another member. > > 3) Don't post questions regarding breaking or bypassing any security > measure. > > 4) Acknowledge the responses you receive, good or bad. > > 5) Cross-promotion of, or links to, forums competitive to this forum in > signatures are prohibited. > > NOTE : Don't ever post personal or confidential data in a workbook. Forum > owners and members are not responsible for any loss. > > > ------------------------------------------------------------------------------------------------------ > To post to this group, send email to excel-macros@googlegroups.com > -- Sam Mathai Chacko -- FORUM RULES (934+ members already BANNED for violation) 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited. NOTE : Don't ever post personal or confidential data in a workbook. Forum owners and members are not responsible for any loss. ------------------------------------------------------------------------------------------------------ To post to this group, send email to excel-macros@googlegroups.com