PDA

View Full Version : Applying If statement to string



harber95
08-05-2015, 10:52 PM
Private Sub TextBox3_Change()
Dim x As Integer
Dim s As String


If x = s Then
MsgBox "Please insert a number"
Else
End If


End Sub

In the code above, I want the textbox to contain numbers only.
If the textbox will contain a letter, I want a message to appear after I press a button.
thanks

mancubus
08-05-2015, 11:12 PM
when you Google, you can find many examples.

like:
http://www.cpearson.com/excel/TextBox.htm

insert your MsgBox line before End Select, under Case Else part.