Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"harpscardiff"
is this starting to sound repetitious. Same advice you received yesterday. -- Regards, Tom Ogilvy "Leith Ross" wrote in message ... Hello Piers 2k, You need to place the macro in the Exit event and use Cancel. You can copy and paste the updated macro into your project. Code: -------------------- Private Sub txtPolicynumber_Exit(ByVal Cancel As MSForms.ReturnBoolean) L = Len(txtPolicynumber.Text) If L 0 And L < 8 Then Msgbox "Invalid Entry. Must be 8 digits long", vbOKOnly + vbCritical, "Data Validation" Cancel = True With txtPolicynumber .SelStart = 0 .SelLength = L .SetFocus End With End If End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=483052 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Strange issue freezing parent form when unloading a child form | Excel Programming | |||
setfocus on user form | Excel Programming | |||
AfterUpdate | Excel Programming | |||
setfocus on multipage tab form gives error message | Excel Programming | |||
SetFocus in user form | Excel Programming |