Cannot put my finger on this tab behaviour.... can anyone ad

Dinictus

Board Regular
Joined
Mar 19, 2002
Messages
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
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi

I ran your code and it worked just fine!
Double check your properties???
 
Upvote 0

Forum statistics

Threads
1,213,558
Messages
6,114,297
Members
448,564
Latest member
ED38

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top