G
Gary Thomson
Hi,
I have the following code:
Dim School As String
School = InputBox("Which School do you wish to see the
budget for?", "Choose School")
If (School <> "Bonnyrigg") Then
MsgBox ("You have entered an incorrect school name")
School = InputBox("Which School do you wish to see the
budget for?", "Choose School")
End If
The code then has a series of Case statements which
execute depending on the value assigned to School.
I have a couple of problems with this:
(1) I wan the If statment to read if(or
(school<>"bonnyrigg", school<>"Bryans",
school<>"Cuiken", ... ,school<>"Woodburn") then
where bonnyrigg, bryans, cuiken, .... , woodburn are in
the range B7:B42 in a worksheet called "School Rolls".
i.e. so that if the school name entered is not one of the
above schools, the user will be informed of this and will
have to re-enter the school.
(2) If the user enters an incorrect school name on
his/her first attempt, the msgbox is displayed, and the
user is then asked to re-enter a valid school name.
However, if the user again enters an incorrect name, the
macro just stops running (i.e. it does not again inform
the user that the school name is invlaid, and ask the user
to re-enter a valid school name). I would like some sort
of loop which will continually ask the user to enter a
valid school name until the user does so.
Many Thanks,
Gary.
I have the following code:
Dim School As String
School = InputBox("Which School do you wish to see the
budget for?", "Choose School")
If (School <> "Bonnyrigg") Then
MsgBox ("You have entered an incorrect school name")
School = InputBox("Which School do you wish to see the
budget for?", "Choose School")
End If
The code then has a series of Case statements which
execute depending on the value assigned to School.
I have a couple of problems with this:
(1) I wan the If statment to read if(or
(school<>"bonnyrigg", school<>"Bryans",
school<>"Cuiken", ... ,school<>"Woodburn") then
where bonnyrigg, bryans, cuiken, .... , woodburn are in
the range B7:B42 in a worksheet called "School Rolls".
i.e. so that if the school name entered is not one of the
above schools, the user will be informed of this and will
have to re-enter the school.
(2) If the user enters an incorrect school name on
his/her first attempt, the msgbox is displayed, and the
user is then asked to re-enter a valid school name.
However, if the user again enters an incorrect name, the
macro just stops running (i.e. it does not again inform
the user that the school name is invlaid, and ask the user
to re-enter a valid school name). I would like some sort
of loop which will continually ask the user to enter a
valid school name until the user does so.
Many Thanks,
Gary.