LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default validation of textbox entries

Good Day Group,

Found below code in this group. It works fine except that the SetFocus
command does not work.
The focus jumps to TextBox2 as set in the "Tab order".

What Iám looking for is a code that validates the TextBox and give a warning
when a letter is entered
in the box, single or mixed with numbers. Only numbers ín any combination
shall be the correct input.

Grateful for help.

Brgds

CG Rosén

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If TextBox1.TextLength = 0 Then
Cancel = True 'to prevent non-entry
Else
With Sheet1.Range("c1:c99")'Where valid entries are located
Set c = .Find(TextBox1.Text)
If c Is Nothing Then
MsgBox TextBox1.Text & " is invalid input"
TextBox1.SetFocus
Exit Sub
End If
End With
End If
End Sub




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox validation TUNGANA KURMA RAJU Excel Discussion (Misc queries) 5 May 8th 09 11:15 PM
Unique entries in textbox Richard Excel Programming 2 March 20th 05 03:41 AM
textbox validation TC[_6_] Excel Programming 2 October 13th 04 03:19 AM
Textbox validation phreud[_17_] Excel Programming 6 June 27th 04 07:49 PM
textbox validation Beginner[_2_] Excel Programming 1 April 7th 04 07:46 PM


All times are GMT +1. The time now is 08:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"