Dim myNum As Long
myNum = Application.InputBox("Enter your number",Type:=1)
Private Sub TextBox1_Change()
With Me.TextBox1
'check if 8 characters exceeded:
If Len(.Text) > 8 Then
.Text = Left(.Text, 8)
Exit Sub
End If
End With
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End Sub