Excel VBA UserForm TextBox - Learn how to check if input is a number or not (on button click)
The code used in this video:
Private Sub cbOk_Click()
If Not IsNumeric(txtPrice) Then
MsgBox "Please enter a valid number", vbCritical
With txtPrice
.SelStart = 0
.SelLength = Len(txtPrice)
.SetFocus
End With
Exit Sub
End If
MsgBox "Price OK"
End Sub