Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am aware of data validation in cells to force text or
numeric values. Is there a way of doing this in a userform text box? You can assign the value of a textbox to a numeric variable, but this is too late when you have clicked the OK button Any help gratefully received |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Angela,
A way of making: Private Sub TextBox1_Change() Me.TextBox1 = CleanChain(Me.TextBox1) End Sub Private Function CleanChain(Chain As String) As String Const Cars As String = "0123456789,." Dim L As String * 1, i As Integer For i = 1 To Len(Chain) L = Mid(Chain, i, 1) Select Case L Case ",", "." L = Application.International(xlDecimalSeparator) If InStr(1, CleanChain, L) Then GoTo 1 End Select If InStr(1, Cars, L) Then CleanChain = CleanChain & L 1: Next i End Function MP "Angela" a écrit dans le message de ... I am aware of data validation in cells to force text or numeric values. Is there a way of doing this in a userform text box? You can assign the value of a textbox to a numeric variable, but this is too late when you have clicked the OK button Any help gratefully received |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks I'll give this a try
Angela -----Original Message----- Hi Angela, A way of making: Private Sub TextBox1_Change() Me.TextBox1 = CleanChain(Me.TextBox1) End Sub Private Function CleanChain(Chain As String) As String Const Cars As String = "0123456789,." Dim L As String * 1, i As Integer For i = 1 To Len(Chain) L = Mid(Chain, i, 1) Select Case L Case ",", "." L = Application.International(xlDecimalSeparator) If InStr(1, CleanChain, L) Then GoTo 1 End Select If InStr(1, Cars, L) Then CleanChain = CleanChain & L 1: Next i End Function MP "Angela" a écrit dans le message de ... I am aware of data validation in cells to force text or numeric values. Is there a way of doing this in a userform text box? You can assign the value of a textbox to a numeric variable, but this is too late when you have clicked the OK button Any help gratefully received . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
well, you could try the same thing for OnChange event for tha
particular testbox. So whatever validation you do after clicking OK you do it in the OnChange event - Manges -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
User Form Text Boxes - Copy format of text boxes | Excel Discussion (Misc queries) | |||
Changing color in text boxes based on content | Excel Discussion (Misc queries) | |||
Dynamic Text boxes in UserForm | Excel Programming | |||
Populate Userform text boxes in VBA with VLookup data from #2 worksheet | Excel Programming | |||
userform text boxes | Excel Programming |