Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() i have an excel form that i want that after the user enters data, whe he tries to exit text box it validates the data for him and if it' valid the background changes to white. i currently have the colors changing if there is any data in the txtbo at all. i would like it to be that it needs to have two names in th field - the director's first and last name. so i want it to check th the first word is more than one letter, followed by a space, and the at least two more letters. i am putting the code in the txtDirector_Exit event. i know the changing color code, i need to code to check the data in th box. thanks in advance tkapla -- tkapla ----------------------------------------------------------------------- tkaplan's Profile: http://www.excelforum.com/member.php...fo&userid=2298 View this thread: http://www.excelforum.com/showthread.php?threadid=46985 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe like this.
Private Sub txt_Director_Exit(ByVal Cancel As MSForms.ReturnBoolean) Dim spac As Integer Dim vld As Boolean spac = InStr(1, txt_Director.Value, " ") If spac < 3 Then vld = False ElseIf spac Len(txt_Director.Value) - 2 Then vld = False Else vld = True End If If Not vld Then Me.txt_Director.BackColor = vbBlue End If End Sub Hope this helps Rowan tkaplan wrote: i have an excel form that i want that after the user enters data, when he tries to exit text box it validates the data for him and if it's valid the background changes to white. i currently have the colors changing if there is any data in the txtbox at all. i would like it to be that it needs to have two names in the field - the director's first and last name. so i want it to check the the first word is more than one letter, followed by a space, and then at least two more letters. i am putting the code in the txtDirector_Exit event. i know the changing color code, i need to code to check the data in the box. thanks in advance tkaplan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You have another reply to your post in .misc
tkaplan wrote: i have an excel form that i want that after the user enters data, when he tries to exit text box it validates the data for him and if it's valid the background changes to white. i currently have the colors changing if there is any data in the txtbox at all. i would like it to be that it needs to have two names in the field - the director's first and last name. so i want it to check the the first word is more than one letter, followed by a space, and then at least two more letters. i am putting the code in the txtDirector_Exit event. i know the changing color code, i need to code to check the data in the box. thanks in advance tkaplan -- tkaplan ------------------------------------------------------------------------ tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987 View this thread: http://www.excelforum.com/showthread...hreadid=469859 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
validate | Excel Discussion (Misc queries) | |||
Looking up a name and then being able to validate it | Excel Worksheet Functions | |||
Looking up a name and then being able to validate it | Excel Worksheet Functions | |||
ActiveX Controls vs Form Controls | Excel Discussion (Misc queries) | |||
Event procedures for controls added with Controls.Add | Excel Programming |