Ok that has fixed part of the problem, the code now runs and correctly fills out team 1 with the correct team members, however the code then stops with a "Mismatch error" and does not fill out any other team.
Dim rngRowToCheck As Excel.Range
Dim rngTeamDetails As Excel.Range
Dim strTeamLookFor As String
Dim rw As Excel.Range
Dim cell As Excel.Range
Dim intPresentationRowNumber As Integer
Dim wsTeamSheet As Excel.Worksheet
Dim wsLookup As Excel.Worksheet
Dim lastRow As Long
lastRow = Cells(Rows.Count, 1).End(xlUp).Row
Set wsTeamSheet = ThisWorkbook.Worksheets("Team Sheet")
Set wsLookup = ThisWorkbook.Worksheets("Lookup")
Set rngRowToCheck = wsTeamSheet.Rows("3:3")
Set rngTeamDetails = wsLookup.Range("t2:v" & lastRow)
For Each cell In rngRowToCheck.Cells
If LCase(cell.Value) Like "team*" Then
intPresentationRowNumber = 10
strTeamToLookFor = LCase(cell.Value)
For Each rw In rngTeamDetails.Rows
If LCase(rw.Cells(, 3).Value) = strTeamToLookFor Then
wsTeamSheet.Cells(intPresentationRowNumber, cell.Column).Value = rw.Cells(, 1).Value
wsTeamSheet.Cells(intPresentationRowNumber, cell.Column + 1).Value = rw.Cells(, 2).Value
intPresentationRowNumber = intPresentationRowNumber + 1
End If
Next rw
End If
Next cell
Bookmarks