http://www.oddsportal.com/soccer/england/premier-league/results/
ed esattamente per quest'ultimo le 8 pag che vengono a crearsi nell'arco di un intero campionato:
http://www.oddsportal.com/soccer/england/premier-league/results/#/page/2/
http://www.oddsportal.com/soccer/england/premier-league/results/#/page/3/
http://www.oddsportal.com/soccer/england/premier-league/results/#/page/4/
http://www.oddsportal.com/soccer/england/premier-league/results/#/page/5/
http://www.oddsportal.com/soccer/england/premier-league/results/#/page/6/
http://www.oddsportal.com/soccer/england/premier-league/results/#/page/7/
http://www.oddsportal.com/soccer/england/premier-league/results/#/page/8/
Infine i dati del link:
http://www.betexplorer.com/soccer/england/premier-league/fixtures/
- Codice: Seleziona tutto
Sub ENGLANDPREMIER()
'
' ENGLANDPREMIER Macro
'
Dim mIE As Object
Dim mTables, mTable
Dim mRows, mRow
Dim mCells, mCell
Dim mRiga As Long, mColonna As Long
Dim k As Integer
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 17
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.betexplorer.com/soccer/england/premier-league/results/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Azzera_Variabili:
Set mCell = Nothing
Set mCells = Nothing
Set mRow = Nothing
Set mRows = Nothing
Set mTable = Nothing
Set mTables = Nothing
mIE.Quit
Set mIE = Nothing
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 500
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 600
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/#/page/2/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 700
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/#/page/3/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 800
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/#/page/4/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 900
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/#/page/5/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 1000
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/#/page/6/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 1100
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/#/page/7/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 1200
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.oddsportal.com/soccer/england/premier-league/results/#/page/8/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
Set mIE = CreateObject("InternetExplorer.Application")
k = 0
mRiga = 1300
With mIE
.AddressBar = False
.StatusBar = False
.MenuBar = False
.Toolbar = 0
.Visible = False
.navigate "http://www.betexplorer.com/soccer/england/premier-league/fixtures/"
End With
While mIE.Busy
Wend
While mIE.document.readyState <> "complete"
Wend
Set mTables = mIE.document.all.tags("TABLE")
For Each mTable In mTables
Set mRows = mTable.Rows
For Each mRow In mRows
Set mCells = mRow.Cells
If Cells(mRiga - 1, 1) = "" Or Cells(mRiga - 1, 1) = "No." Then
mColonna = 1
Else
mColonna = 1
End If
If k = 1 Then mColonna = 1
For Each mCell In mCells
ActiveSheet.Cells(mRiga, mColonna) = mCell.innerText
mColonna = mColonna + 1
Next mCell
mRiga = mRiga + 1
Next mRow
k = 1
Next mTable
MsgBox "Ma cu sugnu."
'
End Sub
Ora il mio problema sta nel fatto che quando devo analizzare un altro campionato, devo andare a cambiare tutti i link, chiedevo se era possibile inserire il link all'interno di una cella di un foglio, e prelevarlo direttamente da li, grazie anticipatamente