![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 162
|
hi,
I`m working on a user form. It consists of a few textboxes. The data inputted here is being organised in an excel sheet. The partial code looks like this: Private Sub TBL1_Change() Worksheets("sheet1").Range("B2").Value = TBL1 If Not IsNumeric(TBL1.Value) Then MsgBox "Alleen numerieke data is toegestaan", vbExclamation, "Invalid Entry" If Len(TBL1.Text) >= 5 Then TBL2.SetFocus End If End Sub Private Sub TBL1_Exit(ByVal Cancel As MSForms.ReturnBoolean) L = Len(Me.TBL1.Value) If L < 5 Then Me.TBL1.Value = Application.Rept("0", 5 - L) & Me.TBL1.Value TBL2.SetFocus End If End Sub This is just the code for 1 textbox. As you can see after filling 5 digits the focus skips to the next textbox, this work fine. What you can also see that if someone fills in 312 and then tabs, 00312 is registred. And then my problem occurs: when tabbing out when less then 5 digits are filled in (using the fill to 5 digits function)the focus is not skipped to textbox 2 but to text box 3!! How can this be? Other facts: Autotab is on Tabindex is correct. I hope someone can give some tips. `Cos I can`t seem to figure it out! [ This Message was edited by: Dinictus on 2002-03-21 02:14 ] |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Hi
I ran your code and it worked just fine! Double check your properties??? |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 162
|
Really?
Of course, you say so... I`ll check my properties again then.. Thanks man. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|