Hi,
I´m trying to force only to allow numeric values to 3 text boxes. The below code is what I can come up with so far by searching the net, but it will not work. Basically it does nothing and if I try to play around with it and change it in any way I just get errors.
Maybe some VBA genius is able to see what might be the problem in this:
Private Sub tbAvtalenummer_Change() OnlyNumbers End Sub Private Sub tbKjøpssum_Change() OnlyNumbers End Sub Private Sub tbLeasingPrMnd_Change() OnlyNumbers End Sub Private Sub OnlyNumbers() If TypeName(Me.ActiveControl) = "TextBox" Then With Me.ActiveControl If Not IsNumeric(.Value) And .Value <> vbNullString Then MsgBox "This is not a valid number." .Value = vbNullString End If End With End If End Sub
Bookmarks