Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Move cursor to textbox in a userform
Hi, I would like to check (on Exit) a value entered in a textbox with certain cell. That's not the problem, but I would like to find a metho how to move the cursor to the wrong entered value (so: back to tha textbox). The error is given in a MsgBox. Thanks in advance -- jgmidde ----------------------------------------------------------------------- jgmiddel's Profile: http://www.excelforum.com/member.php...fo&userid=3271 View this thread: http://www.excelforum.com/showthread.php?threadid=52754 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Move cursor to textbox in a userform
TextBox1.SetFocus
"jgmiddel" wrote: Hi, I would like to check (on Exit) a value entered in a textbox with a certain cell. That's not the problem, but I would like to find a method how to move the cursor to the wrong entered value (so: back to that textbox). The error is given in a MsgBox. Thanks in advance! -- jgmiddel ------------------------------------------------------------------------ jgmiddel's Profile: http://www.excelforum.com/member.php...o&userid=32714 View this thread: http://www.excelforum.com/showthread...hreadid=527545 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Move cursor to textbox in a userform
Better to use the Exit Event of the Textbox to check the entry. Then if it
is improper, the Event has a Cancel variable. If you set this to False, the textbox won't be exited. It sounds like you are probably already using this event to popup a msgbox, so just set the Cancel variable to true. -- Regards, Tom Ogilvy "jgmiddel" wrote: Hi, I would like to check (on Exit) a value entered in a textbox with a certain cell. That's not the problem, but I would like to find a method how to move the cursor to the wrong entered value (so: back to that textbox). The error is given in a MsgBox. Thanks in advance! -- jgmiddel ------------------------------------------------------------------------ jgmiddel's Profile: http://www.excelforum.com/member.php...o&userid=32714 View this thread: http://www.excelforum.com/showthread...hreadid=527545 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Move cursor to textbox in a userform
Hello
In addition, you could highlight the whole (wrong)entry with: With Me.TextBox1 ..SelStart = 0 ..SelLength = Len(.Value) ..SetFocus End With HTH Cordially Pascal |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Move cursor to textbox in a userform
Tom, The data must be proceeded in a worksheet, so I use this: Private Sub naam1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If Range("Werkblad!A12") < 3 Then Dim Msg, Style, Title, Response Msg = Range("error1").Value Style = vbInformation Title = Range("naam").Value Response = MsgBox(Msg, Style, Title) On Error Resume Next Userform.naam1.SetFocus End If End Sub You say, the exit can be canceled. What I made doesn't work -- jgmidde ----------------------------------------------------------------------- jgmiddel's Profile: http://www.excelforum.com/member.php...fo&userid=3271 View this thread: http://www.excelforum.com/showthread.php?threadid=52754 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Move cursor to textbox in a userform
Done! Private Sub naam1_Exit(ByVal Cancel As MSForms.ReturnBoolean) If Range("Werkblad!A12") < 3 Then Dim Msg, Style, Title, Response Msg = Range("error1").Value Style = vbInformation Title = Range("naam").Value Response = MsgBox(Msg, Style, Title) On Error Resume Next Cancel = True End If End Su -- jgmidde ----------------------------------------------------------------------- jgmiddel's Profile: http://www.excelforum.com/member.php...fo&userid=3271 View this thread: http://www.excelforum.com/showthread.php?threadid=52754 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
move cursor on one sheet moves cursor on all sheets | Excel Discussion (Misc queries) | |||
Userform - Move to next textbox field by hitting enter instead of | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
How to move cursor from one textbox control to another textbox con | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |