Checking Entry

M

mushy_peas

Is there a way of checking the input of a Msgbox in terms of if it
numeric or alphabetical

eg if i only want alphabetical, and someone enter a number o
alpnumric, then get to to display a warning.

Cheer
 
V

Vasant Nanavati

A MessageBox does not have input. You are probably referring to an InputBox.

Look at Help for the InputBox Method rather than the InputBox Function. The
former allows you control over the input type.
 
M

mushy_peas

sorry, the box is a simple, ie
Colset = InputBox("What column is the PASS Results", "Selec
Results Column"
 
C

chris

you can use this as a function or embed it in your code

sub MySub(

Colset = InputBox("What column is the PASS Results", "Selec
Results Column"
if IsAlpha(Colset) = False then Msgbox "No numbers allowed" : Exit su

end su

Function IsAlpha(Colset) As Boolea
Dimy As Long, z As Lon
y = Len(colset
For z = 1 To
If Mid(colset, z, 1) Like "[0-9]" The
IsAlpha = Fals
Exit Functio
Nex
IsAlpha = Tru
End Function
 
C

chris: forgot 'end if'

Function IsAlpha(Colset) As Boolea
Dim y As Long, z As Lon
y = Len(Colset
For z = 1 To
If Mid(x, z, 1) Like "[0-9]" The
IsAlpha = Fals
Exit Functio
End If <<<<<<<<
Nex
IsAlpha = Tru
End Functio







----- chris wrote: ----

you can use this as a function or embed it in your code

sub MySub(

Colset = InputBox("What column is the PASS Results", "Selec
Results Column"
if IsAlpha(Colset) = False then Msgbox "No numbers allowed" : Exit su

end su

Function IsAlpha(Colset) As Boolea
Dimy As Long, z As Lon
y = Len(colset
For z = 1 To
If Mid(colset, z, 1) Like "[0-9]" The
IsAlpha = Fals
Exit Functio
Nex
IsAlpha = Tru
End Function
 
M

mushy_peas

thanks ~ x but its dodnt quite work. even if i enter a number no messag
comes up
 
Top