Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub GTOTM()
- Call GetLogs
- Dim Team As String
- Dim Team1D() As Variant
- Dim TeamRep() As Variant
- Dim size As Integer
- For j = LBound(samLogs) To TotalRows - 1
- If InStr(samLogs(1, j), "2021") Then
- Team = samLogs(7, j)
- If IsArrayAllocated(Team1D) Then
- If IsInArray(Team, Team1D) Then
- For h = LBound(Team1D) To UBound(Team1D)
- If Team1D(h) = Team Then
- TeamRep(h) = TeamRep(h) + 1
- End If
- Next h
- Else
- size = size + 1
- ReDim Preserve Team1D(size)
- ReDim Preserve TeamRep(size)
- Team1D(size - 1) = Team
- TeamRep(size - 1) = 1
- End If
- Else
- size = 1
- ReDim Team1D(size)
- ReDim TeamRep(size)
- Team1D(0) = Team
- TeamRep(0) = 1
- End If
- End If
- Next j
- For i = LBound(Team1D) To UBound(Team1D)
- 'Debug.Print Team1D(i) & " " & TeamRep(i)
- If TeamRep(i) = WorksheetFunction.Max(TeamRep) Then
- Debug.Print Team1D(i)
- End If
- Next i
- End Sub
- Function IsArrayAllocated(Arr As Variant) As Boolean
- On Error Resume Next
- IsArrayAllocated = IsArray(Arr) And Not IsError(LBound(Arr, 1)) And LBound(Arr, 1) <= UBound(Arr, 1)
- End Function
- Function IsInArray(stringToBeFound As String, Arr As Variant) As Boolean
- For i = LBound(Arr) To UBound(Arr)
- If Arr(i) = stringToBeFound Then
- IsInArray = True
- Exit Function
- End If
- Next i
- IsInArray = False
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement