Hi guys
The user enters a number in textbox1,I want to convert in into 3 digits and store it in a variable. Suppose textbox1.value=5 then the variable a =005
If textbox1.value=10 then a=010
I hope canyone can help me out.
Thanks
Aman
Hi guys
The user enters a number in textbox1,I want to convert in into 3 digits and store it in a variable. Suppose textbox1.value=5 then the variable a =005
If textbox1.value=10 then a=010
I hope canyone can help me out.
Thanks
Aman
A would have to be a string to save it as 3 digits with leading zeros
A = right("000" & textbox1.text,3)
Regards
Darren
Update 12-Nov-2010 Still job hunting!
If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.
Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!
You can try something like this :
Sub digit()
Dim a As Variant
a = InputBox("3 digits")
If Len(a) = 1 Then
a = "00" & a
MsgBox a
Else
End If
End Sub
Try this in your UserForm Code
![]()
Please Login or Register to view this content.
The user can only enter numbers and is limited to a total of three.
I hope this might be of some help.
Last edited by Marcol; 05-28-2010 at 06:10 AM.
@ le6tata,
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
The simplest method: (use what is available in VBA)
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks