leeksleeks
Board Regular
- Joined
- Oct 31, 2013
- Messages
- 96
Hi,
I am very interested in sports stats and am trying to import stats from multiple pages on the same website. For example in the below code it has game-93920 and the next page I would like to get the stats from is 93921. As each page has a unique code that is always 1 greater than the one before, is there anyway the 93920 can be replaced with an 'x'? If so I would ideally like each page to be pasted onto a new worksheet. Here is what I have done so far:
Sub importdata()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.itsrugby.co.uk/game-93920.html", Destination:=Range("$A$1"))
.Name = "game-93920"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "9,12"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
I have browsed other people having the same problem but cannot find anything that works for me. Any help would be greatly appreciated as this has stumped me for a long time.
Cheers
I am very interested in sports stats and am trying to import stats from multiple pages on the same website. For example in the below code it has game-93920 and the next page I would like to get the stats from is 93921. As each page has a unique code that is always 1 greater than the one before, is there anyway the 93920 can be replaced with an 'x'? If so I would ideally like each page to be pasted onto a new worksheet. Here is what I have done so far:
Sub importdata()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.itsrugby.co.uk/game-93920.html", Destination:=Range("$A$1"))
.Name = "game-93920"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "9,12"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
I have browsed other people having the same problem but cannot find anything that works for me. Any help would be greatly appreciated as this has stumped me for a long time.
Cheers