MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
With RegEx .Pattern = "ROW(S)? (\d+)-(\d+)" _______________________________________________________ ENTIRE CODE: Function GetSeats(InputCell As Range) As String ' 'brettdj Dim RegEx, RegM, RegMC Dim MyDic Dim tmpStr As String Dim i As Long Set MyDic = CreateObject("scripting.dictionary") Set RegEx = CreateObject("vbscript.regexp") With RegEx .Pattern = "ROW(S)? (\d+)-(\d+)" .Global = True .IgnoreCase = True If .test(InputCell.Value) Then Set RegMC = .Execute(InputCell) For Each RegM In RegMC If MyDic.exists(LCase$(RegM)) = False Then For i = RegM.submatches(1) To RegM.submatches(2) Select Case i Case Is <= 4 tmpStr = tmpStr & i & "ACDF, " Case Else tmpStr = tmpStr & i & "ABCDEF, " End Select Next tmpStr = Left$(tmpStr, Len(tmpStr) - 2) MyDic.Add LCase$(RegM), 1 End If Next End If .Pattern = "\d+[A-M]+" If .test(InputCell.Value) Then Set RegMC = .Execute(InputCell) For Each RegM In RegMC If tmpStr = vbNullString Then tmpStr = RegM Else tmpStr = tmpStr & ", " & RegM End If Next End If GetSeats = tmpStr End With End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.