[User form] input text box, on tab fills to 5 figures 321 -

Dinictus

Board Regular
Joined
Mar 19, 2002
Messages
162
Hi I`ve had some great help on a user form from Audiojoe today. I`ve come quite far but there are still a few things I can`t seem to figure out.

I`ve made a userform for data entry purposes.
Each textbox must be filled with 5 figures however sometimes the input is e.g. 321 What I want is that on tab (swith to the next textbox 00321 is filled in.
How can I get the form to do that?

Also what I would like is that when someone filles in 5 figures in the first textboxt, the cursor automatically switches to the next box.

My current source for a textbox:

Private Sub TBL1_Change()
Worksheets("sheet1").Range("B2").Value = TBL1
End Sub

Can anyone hand me some clue`s?

thanks.

Dinictus.
Holland
This message was edited by Dinictus on 2002-03-20 07:01
 
You will need to set your TabIndex correctly though (found in the properties window). Also, you will have to set
other textboxes properties to:

MaxLength = 5
AutoTab = true
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Right,

Now the code for 1 textbox looks like this. The only this which doesn`t work now is skipping to the next textbox if 5 digits are present:

Private Sub TBL1_Change()
Worksheets("sheet1").Range("B2").Value = TBL1
If Not IsNumeric(TBpanel.Value) Then
MsgBox "Only numeric data is allowed", 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
End If
End Sub

Does anyone see where it is going wrong?
 
Upvote 0
aargg!

The autotab was on False. Everything works just fine now.
Thanks so much!

an honourable mention for Audiojoe, who almost seems to go down by his own enthousiasm. I think I`m going to like this forum a lot!
This message was edited by Dinictus on 2002-03-20 08:15
 
Upvote 0
Thanks man, but what's all this business about me going down on my own enthusiasm? Wouldn't I need to remove a rib first or something?
 
Upvote 0
Perhaps the expression is wrong. does it mean something mean? I didn`t mean to. I`m not English by the way...
 
Upvote 0
I was messing about man, don't worry. To "go down on something" kinda means....well....me being a gentleman and all, prevents me from going too much into it. Try eating passion fruit and you'll know what I'm talking about
This message was edited by Audiojoe on 2002-03-20 08:46
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,034
Members
448,543
Latest member
MartinLarkin

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