The answer to this question is to add an _Exit procedure. Updated file to show the solution is available at http://www.mediafire.com/file/wjkmmrzlkwm/FormTestExampleUpdated.xlsm
On Jun 4, 10:45 pm, Jerry <centau...@live.co.uk> wrote: > I have a textbox the content of which I need to validate once the user > has updated it in the _AfterUpdate event.If a character is invalid, I > highlight it and display an error message in a label control. E.G. > > tbInput.SelStart = i - 1 > tbInput.SelLength = 1 > > and try to give it the focus: > > tbInput.SetFocus > > Although the invalid character is highlighted, the user must use the > tab key before being able to overtype the character or delete it. How > can I avoid forcing the user to press the tab key first? > > I have a sample spreadsheet illustrating the problem available > athttp://www.mediafire.com/file/iiji2znng2y/FormTestExample.xlsm -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 7000 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe