ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Input mask for userform textbox (https://www.excelbanter.com/excel-programming/315950-input-mask-userform-textbox.html)

Axehandler

Input mask for userform textbox
 
I am tying to set up an input mask for a textbox in a userfrom.

The user will only be able to enter a 12 character string.
The string will look like GSSL########
All entries into this box must have GSSL at the beginning,
and the ######## represents any 8 digit number.

Is this even possible in Excel.

I have been trying to crack this for some time.

I am extremly new to VBA and i could be missing something simple.

Any help appriciated.
Axe.

JulieD

Input mask for userform textbox
 
Hi

personally i would create a text box that required the user to only enter
the 8 digits, then on exit of the text box i would check the length and
whether or not it is a number, then i would append the GSSL bit myself
e.g.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim snum As String
If Len(TextBox1.Value) < 8 Or
Application.WorksheetFunction.IsNumber(Val(TextBox 1.Value)) = False Then
MsgBox "Please ensure that number you enter has eight digits"
End If
snum = "GSSL" & TextBox1.Value
End Sub

Cheers
JulieD

"Axehandler" wrote in message
om...
I am tying to set up an input mask for a textbox in a userfrom.

The user will only be able to enter a 12 character string.
The string will look like GSSL########
All entries into this box must have GSSL at the beginning,
and the ######## represents any 8 digit number.

Is this even possible in Excel.

I have been trying to crack this for some time.

I am extremly new to VBA and i could be missing something simple.

Any help appriciated.
Axe.





All times are GMT +1. The time now is 01:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com