Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Guys
I'm sure to many of you this is very obvious, but to me it's a problem. On a userform the user must key in a barcode [18 digits]. 90plus% of the time only the last 2 numbers change. Thus I would like to give him a start & display the previous number in the textbox. I've succeeded with that, but no matter what I try I keep on getting an error in the the range("Ont11") ie if I enter 123456789012345678 I would get this displayed in the range : 1.23456789012346E+17 I've tried formatting etc without any joy. Please help this dummy Tks in advance Public Sub GetPalId() Dim userEntry As String Dim Ont10 As Range PaletIden.TextBox1.Value = Range("Tet4").Value PaletIden.Show userEntry = Val(PaletIden.TextBox1.Value) Unload PaletIden Range("Ont11") = userEntry End Sub -- HJN |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Follow your own logic: STRING! Format the cells in question as Text, and don't use Val (which converts text to number). With PaletIden.TextBox1 ..Text = Range("Tet4").Value ..SelStart = Len(.Text) - 2 ..SelLength = 2 End With PaletIden.Show userEntry = PaletIden.TextBox1.Text Also, your range names TET4 and ONT11are cell addresses in Excel2007 files, so consider anotner naming practice for version compatibility. HTH. Best wishes Harald "Hennie Neuhoff" wrote in message ... Hi Guys I'm sure to many of you this is very obvious, but to me it's a problem. On a userform the user must key in a barcode [18 digits]. 90plus% of the time only the last 2 numbers change. Thus I would like to give him a start & display the previous number in the textbox. I've succeeded with that, but no matter what I try I keep on getting an error in the the range("Ont11") ie if I enter 123456789012345678 I would get this displayed in the range : 1.23456789012346E+17 I've tried formatting etc without any joy. Please help this dummy Tks in advance Public Sub GetPalId() Dim userEntry As String Dim Ont10 As Range PaletIden.TextBox1.Value = Range("Tet4").Value PaletIden.Show userEntry = Val(PaletIden.TextBox1.Value) Unload PaletIden Range("Ont11") = userEntry End Sub -- HJN |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
UserForm and user input | Excel Programming | |||
Have user input converted to uppercase in same cell as input? | New Users to Excel | |||
CODE to select range based on User Input or Value of Input Field | Excel Programming | |||
How to get User input from Userform Text box | Excel Programming | |||
String length of Inputbox user input. | Excel Programming |