Hello everybody,
I'm creating a userform that allows the user to enter up to 6 digits in the textbox1 and non-0 digits in the textbox2.
The contents of the 2 textboxes are concatenated to form a single 9-digit number.
example:
textbox1 = 123456 // textbox2 = 0 => 123456000
textbox1 = 123 // textbox2 = 1 => 123000001
With the worksheetfunction.text I can display 0s in front of the number entered in the textbox2 either 1 >> 001
On the other hand, I can't add 0s after the numbers entered in the textbox1
Does anyone know how to do it? Thank you in advance for your help.
I'm creating a userform that allows the user to enter up to 6 digits in the textbox1 and non-0 digits in the textbox2.
The contents of the 2 textboxes are concatenated to form a single 9-digit number.
example:
textbox1 = 123456 // textbox2 = 0 => 123456000
textbox1 = 123 // textbox2 = 1 => 123000001
With the worksheetfunction.text I can display 0s in front of the number entered in the textbox2 either 1 >> 001
Rich (BB code):
Suffix2 = UserForm2.TextBox2.Value
SufX2 = WorksheetFunction.Text(Suffix2, "000")
On the other hand, I can't add 0s after the numbers entered in the textbox1
Does anyone know how to do it? Thank you in advance for your help.
Rich (BB code):
If UserForm2.TextBox2.Value = "" Then
Suffix1 = UserForm2.TextBox1.Value
SufX1 = WorksheetFunction.Text(Suffix1, "000000")
Range("OF_Num").Value = UserForm2.TextBox1.Value & "000000"
Else
Suffix1 = UserForm2.TextBox1.Value
SufX1 = WorksheetFunction.Text("000000", Suffix1)
Suffix2 = UserForm2.TextBox2.Value
SufX2 = WorksheetFunction.Text(Suffix2, "000")
Range("OF_Num").Value = UserForm2.TextBox1.Value & SufX1 & UserForm2.TextBox2.Value & SufX2
End If