Sub Macro7()
Dim rVillaNo As Range
Dim resName As String
Dim Resp As String
Dim Meal As VbMsgBoxResult, GFO As VbMsgBoxResult
Sheets("Residents").Select
ActiveSheet.Unprotect
Range("j1").Select
Resp = InputBox(" What is the Resident's Villa No?.")
Application.EnableEvents = False
If Len(Resp) > 0 Then
On Error Resume Next
Set rVillaNo = Range("VillaNo").Find(What:=Resp, LookAt:=xlWhole, SearchDirection:=xlDown)
If Not rVilla Is Nothing Then
'Do
Application.Goto Reference:=rVillaNo.Offset(0, -3), Scroll:=True
resName = rVillaNo.Offset(n, -2) & " " & rVillaNo.Offset(n, -1)
Meal = MsgBox("Is " & resName & " Coming?", vbYesNo, " Who is coming From Villa " & Resp)
Select Case Meal
Case vbYes
rVillaNo.Offset(n, -3).Value = 1
GFO = MsgBox(("Does " & resName & " require a Gluten Free meal ?"), vbYesNo, "Gluten Free Meal for Villa Number " & Resp)
If GFO = vbYes Then
rVillaNo.Offset(n, 2) = "Y"
Else
rVillaNo.Offset(n, 2).Value = ""
End If
Case vbNo
rVillaNo.Offset(n, -3).Value = ""
Case Else
'Exit Sub
End Select
n = n + 1
'Loop Until rVillaNo.Offset(n, 0).Value <> rVillaNo.Value
End If
End If
Application.EnableEvents = True
End Sub
I am having trouble inserting one futher prompt in the loop. The code above works fine and I have removed the colour coding
InputBox= ("Whose table will Resident be sitting At")
response is a Name eg "Alphonso"
Some Villa have 2 residents. It need to loop to ask the prompty for each resident.
The registration form from which all the input data is sourced limits table sizes to 4,10, or 16. There is no need code the table limits.
I have also attached my part of my file
many Thanks for you help
Garry