Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
MSG BOX PREVENTS SET FOCUS POST 2
If msg box line is removed from code, text box will be the focus and text
selected. With MSG BOX line left in, its like it just skips the focus and highlight code Private Sub txtphone_Change() If Not IsNumeric(txtphone) Then MsgBox "Must be Numeric" txtphone.SetFocus txtphone.SelStart = 0 txtphone.SelLength = 1000 End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
MSG BOX PREVENTS SET FOCUS POST 2
See one alternative at your other post.
helpless in iowa wrote: If msg box line is removed from code, text box will be the focus and text selected. With MSG BOX line left in, its like it just skips the focus and highlight code Private Sub txtphone_Change() If Not IsNumeric(txtphone) Then MsgBox "Must be Numeric" txtphone.SetFocus txtphone.SelStart = 0 txtphone.SelLength = 1000 End If End Sub -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
MSG BOX PREVENTS SET FOCUS POST 2
Hello helpless in iowa,
I would rather get rid of the message box and use instead a label to get the attention of the user for example, and I presume that you're using a Userform: Label2.Visible = True 'alerts the user to enter a numeric value txtphone.SetFocus txtphone.SelStart = 0 txtphone.SelLength = 1000 But in the UserForm_Initialize() you have to initialize the Label2.Visible as False, otherwise it appear when the Userform appears for the first time, which you won't like. Swisse |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
website prevents excel import web query | Excel Discussion (Misc queries) | |||
Simplifying a formula that prevents negative numbers | Excel Discussion (Misc queries) | |||
Excel prevents XP Pro laptop going on standby | Excel Discussion (Misc queries) | |||
what exactly prevents INDIRECT from accessing closed worksheets? | Excel Worksheet Functions | |||
MSG BOX PREVENTS setfocus HELP | Excel Programming |