preventing input of illegal characters in an inputbox
'THIS ERROR TRAPPING ROUTINE SHOULD WORK TOO
Sub AllowableNames()
Dim bErr As Boolean
Dim strInput As String
Do
On Error GoTo OopsErr
bErr = False
strInput = InputBox("Enter Range Name")
'***YOUR CODE HERE***
Range("F6:H13").Select
ActiveWorkbook.Names.Add Name:=strInput,
RefersToR1C1:="=Sheet1!R6C6:R13C8"
GoTo OK
OopsErr:
bErr = True
Resume Next
OK:
Loop Until bErr = False
End Sub
-----Original Message-----
Still a little new at vba. Can someone tell me how to
prevent someone from entering in spaces or any illegal
characters (like & % @ etc) into an InputBox? At least
without writing a whole lot of "ElseIf" statements?
I have my script so it so names the range as whatever
they
type. That's why I need to restrict entries. Thanks.
.
|