Hi everybody, as i understand CInt() converts STRING variables to INTEGER variables.
I am trying to create an inputbox, with input validation. So, if the user types in an integer, it will continue to a msgbox; if they type a number in string format, as in 'two', it will convert this into an integer and again display it in a msgbox; if they press nothing a msgbox will appear telling them there is no input; and if they press cancel the programme closes. Any help would be appreciated.
Sub x()
Dim heads As String, tails As Integer
If heads = InputBox("enter a number", , _
vbOKCancel) = vbCancel Then
Application.Close
ElseIf IsNumeric(heads) Then
CInt(heads)= tails
Else
Msgbox "No number, stupid"
Exit Sub
End If
Msgbox heads & " " & tails
End Sub
Bookmarks