LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Form, SetFocus and AfterUpdate issue

"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
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
Strange issue freezing parent form when unloading a child form Stefano Gatto Excel Programming 1 November 11th 05 04:42 PM
setfocus on user form inquirer Excel Programming 7 May 17th 05 12:28 AM
AfterUpdate bforster1[_26_] Excel Programming 1 November 6th 04 07:16 PM
setfocus on multipage tab form gives error message Cheryl Excel Programming 3 July 28th 04 03:07 PM
SetFocus in user form John Tjia Excel Programming 6 February 2nd 04 03:05 PM


All times are GMT +1. The time now is 02:39 PM.

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"