Dim IsNotOnlyNumbers As Boolean For i = 1 to Len(Text1.Text) If Asc(Mid(Text1.Text, i, 1)) < 48 Or Asc(Mid(Text1.Text, i, 1)) > 57 Then IsNotOnlyNumbers = True Exit For End If Next
Private Sub Text1_Change() Dim strText As String strText = Text1.Text If Not IsNumeric(strText) And Len(strText) > 0 Then MsgBox "Der må ikke være bogstaver i boksen." End If End Sub
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.