I have a list of about 200 URLs in a column in excel.
I want to write a macro that will:
Active Cell is A1. A1's value it the text
http://web1.ncaa.org/d1mfb/2002/Inte...09teamoff.html
I need the macro to go to the webpage, get the data from Tables 3 and 4 on
the website, and paste them in a new sheet
Here is the code that gets recorded in excel 2007:
ActiveWorkbook.Worksheets.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://web1.ncaa.org/d1mfb/2002/Internet/ranking_summary/2002000000009teamoff.html" _
, Destination:=Range("$A$1"))
.Name = "2002000000009teamoff"
.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,4"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
This works for me, except that I want the macro to go to the URL which is
the cell value of the current cell (before running the macro). So in the
above example, the value of the actuve cell is the text:
http://web1.ncaa.org/d1mfb/2002/Inte...09teamoff.html