Try this:
Option Explicit
Sub ImportMacro()
Dim StartPage As Long
Dim StopPage As Long
Dim NextRow As Long
Dim I As Long
Dim PageIndex As String
Dim RootPath As String
RootPath = "URL;http://biz.yahoo.com/c/ec/"
StartPage = 201101
StopPage = 201142
For I = StartPage To StopPage
PageIndex = Format(I, "000000.html")
With ActiveSheet.QueryTables.Add(Connection:=RootPath & PageIndex, _
Destination:=Range("A" & Rows.Count).End(xlUp).Offset(1))
.Name = PageIndex
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingRTF
.WebTables = "4"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Next I
End Sub
Bookmarks