LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default how to keep focus on txt_box in userform

Hi,

i have the following code for a txt_box on a userform:

Private Sub nw_premieNP_Exit(ByVal Cancel As MSForms.ReturnBoolean)
OnlyNumbers nw_premieNP
Worksheets("staffelberekening").Range("G12") = nw_premieNP.Value
End Sub

the Only numbers sub looks like

Private Sub OnlyNumbers(ctl As Object)
With ctl
If Not IsNumeric(Left(.Value, 1)) And .Value < vbNullString Then
MsgBox "Sorry, alleen getallen toegestaan", vbOKOnly, "De Pensioen
Adviseur"
.Value = vbNullString
.SetFocus
End If
End With
End Sub

The problem is that if the input is not numeric, the input is deleted but the
focus is put on the next input box.
How can i have the focus on the field that was input wrong ?

thanks,
Pierre


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200509/1
 
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
Switch focus to inactive userform GrahamUNC Excel Programming 2 April 15th 05 09:37 PM
Object on userform can't get focus Jos Vens[_2_] Excel Programming 3 February 28th 05 11:50 PM
Show userform without it taking focus? leah Excel Programming 2 August 10th 04 07:07 PM
Focus on Control before UserForm(s) pop up Bob Phillips[_6_] Excel Programming 0 May 5th 04 04:03 PM
UserForm Loss Focus Orlando Magalhães Filho Excel Programming 2 September 5th 03 04:47 AM


All times are GMT +1. The time now is 04:24 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"