I have the VBA code below that works on my windows machine but will not run on my mac. I need to adjust it so it will works on both platforms. I am running Lion and Excel 2011 for mac. Can anybody help. Here is the code.
Sub ConsolidateWinLoss()
Dim wksARD As Worksheet
Dim wksGIS As Worksheet
Dim varARDTeams As Variant
Dim varGIS As Variant
Dim varOpponents As Variant
Dim varOpntWinLoss As Variant
Dim lngARD As Long
Dim lngGIS As Long
Dim lngOpnt As Long
Dim objDic As Object
Dim lngWins As Long
Dim lngLoss As Long
Set wksARD = Worksheets("Automated Ranking Data")
Set wksGIS = Worksheets("Game Input Sheet")
varARDTeams = wksARD.Range("A3:A" & wksARD.Cells(Rows.Count, 1).End(xlUp).Row)
varGIS = wksGIS.Range("A3:F" & wksGIS.Cells(Rows.Count, 1).End(xlUp).Row)
ReDim varOpntWinLoss(LBound(varARDTeams) To UBound(varARDTeams), 1 To 2)
Set objDic = CreateObject("Scripting.Dictionary")
objDic.comparemode = 1
For lngARD = LBound(varARDTeams) To UBound(varARDTeams)
For lngGIS = LBound(varGIS) To UBound(varGIS)
If varARDTeams(lngARD, 1) = varGIS(lngGIS, UBound(varGIS, 2) - 1) Then
If Not objDic.Exists(varGIS(lngGIS, UBound(varGIS, 2))) Then
objDic.Add varGIS(lngGIS, UBound(varGIS, 2)), varGIS(lngGIS, UBound(varGIS, 2))
End If
ElseIf varARDTeams(lngARD, 1) = varGIS(lngGIS, UBound(varGIS, 2)) Then
If Not objDic.Exists(varGIS(lngGIS, UBound(varGIS, 2) - 1)) Then
objDic.Add varGIS(lngGIS, UBound(varGIS, 2) - 1), varGIS(lngGIS, UBound(varGIS, 2) - 1)
End If
End If
Next lngGIS
If objDic.Count <> 0 Then
varOpponents = objDic.Keys
For lngOpnt = LBound(varOpponents) To UBound(varOpponents)
For lngGIS = LBound(varGIS) To UBound(varGIS)
If varGIS(lngGIS, UBound(varGIS, 2)) = varOpponents(lngOpnt) Then
lngLoss = lngLoss + 1
End If
If varGIS(lngGIS, UBound(varGIS, 2) - 1) = varOpponents(lngOpnt) Then
lngWins = lngWins + 1
End If
Next lngGIS
Next lngOpnt
End If
objDic.RemoveAll
varOpntWinLoss(lngARD, 1) = lngWins: lngWins = 0
varOpntWinLoss(lngARD, 2) = lngLoss: lngLoss = 0
Next lngARD
wksARD.Range("D3").Resize(lngARD - 1, 2).Value = varOpntWinLoss
End Sub
Bookmarks