I am trying to vlookup multiple values in one cell based on the a selection from another cell.
I have the below table where I select a single "Gym" the "GymIDs" is automatically populated. I have then used the below VBA to allow me to select multiple "Gyms", I also want it to show me multiple "GymIDs".
Current vlookup =VLOOKUP(M7,Ignore!F1:G300,2,FALSE)
for some reason I could only upload one image so put them all together
VBA code for multiple selections
Private Sub Worksheet_Change(ByVal Target As Range)
'Code by Sumit Bansal from https://trumpexcel.com
' To Select Multiple Items from a Drop Down List in Excel
Dim Oldvalue As String
Dim Newvalue As String
On Error GoTo Exitsub
If Not Intersect(Target, Range("M7:M30")) Is Nothing Then
    If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
    GoTo Exitsub
    ElseIf Target.Value = "All" Then GoTo Exitsub
    ElseIf Target.Value = "Select" Then GoTo Exitsub
    ElseIf Target.Value = "" Then GoTo Exitsub
    Else
        Application.EnableEvents = False
        Newvalue = Target.Value
        Application.Undo
        Oldvalue = Target.Value
        If Oldvalue = "" Then
            Target.Value = Newvalue
        ElseIf Oldvalue = "All" Then
            Target.Value = Newvalue
        ElseIf Oldvalue = "Select" Then
            Target.Value = Newvalue
        Else
            Target.Value = Oldvalue & ", " & Newvalue
        End If
    End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
 
    