Sub Bucko3030()
'
' Bucko3030 Macro
'
Dim aBrowser As Object
Dim htm As Object
Dim elemCollection As Object
Dim URLPArray
Dim ShtArray
Dim MyArray
Dim d As Long, r As Long, c As Long
Dim i As Integer
URLPArray = Array("C,RW,LW,D", "G&conference=NHL&year=season_2013&qualified=1")
ShtArray = Array("Players", "Goalies")
Application.Calculation = xlCalculationManual
For i = 0 To 1
Sheets(ShtArray(i)).Select
Range("A1").Select
Set aBrowser = CreateObject("InternetExplorer.Application")
With aBrowser
.Silent = True
.Visible = False
.Navigate "
http://ca.sports.yahoo.com/nhl/stats/byposition?pos=" & URLPArray(i) & """"
While .Busy Or .ReadyState <> 4: DoEvents: Wend
End With
Set htm = aBrowser.Document
Set elemCollection = htm.getElementsBytagName("table")(4)
For r = 0 To elemCollection.Rows.Length - 1
ReDim MyArray(elemCollection.Rows(0).Cells.Length - 1)
d = 0
For c = 0 To elemCollection.Rows(r).Cells.Length - 1
If c > 2 And elemCollection.Rows(r).Cells(c).innertext = Chr$(32) Then GoTo Nxtc
MyArray(d) = elemCollection.Rows(r).Cells(c).innertext
d = d + 1
Nxtc:
Next c
Cells(r + 1, 1).Resize(, elemCollection.Rows(0).Cells.Length) = MyArray
Nxtr:
Next r
Set aBrowser = Nothing
Set htm = Nothing
Set elemCollection = Nothing
Next i
Application.Calculation = xlCalculationAutomatic
'
End Sub