I recorded a macro to get a table from a website . I need to know how to get the same table for more then 1 website . I know the range of the sites .
so for Instance .
http://www.wagertracker.com/Odds.asp...2011&sport=MLB
thru
http://www.wagertracker.com/Odds.asp...2011&sport=MLB
Code:
Sub Macro2()
'
' Macro2 Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.wagertracker.com/Odds.aspx?date=3/31/2011&sport=MLB", _
Destination:=Range("$A$1"))
.Name = "2011&sport=MLB"
.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 = "3"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Rows("2:3").Select
Range("A3").Activate
Selection.Delete Shift:=xlUp
Rows("3:4").Select
Range("A4").Activate
Selection.Delete Shift:=xlUp
Range("A2").Select
ActiveCell.FormulaR1C1 = " 3/31/2011"
Columns("A:J").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A3").Select
Columns("A:A").ColumnWidth = 39.71
Columns("F:F").ColumnWidth = 35
Columns("F:F").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.ColumnWidth = 1.86
Columns("A:A").ColumnWidth = 35
Columns("E:E").EntireColumn.AutoFit
Columns("K:K").EntireColumn.AutoFit
Range("7:7,11:11,15:15").Select
Range("A15").Activate
Selection.Delete Shift:=xlUp
Range("4:4,7:7,10:10,A2").Select
Range("A2").Activate
Selection.Font.Bold = True
Selection.Font.Italic = True
Selection.Font.Underline = xlUnderlineStyleSingle
Range("A14").Select
End Sub
any help would be appreciated . thanks