如何让Querytables结果login在同一张表上

我从一个站点提取数据,一次限制数据的显示为75行,其中一些数据集包含100条logging
(为什么没有所有logging的选项)?

我可以安排我的循环创build一个新的工作表,但是这会增加更多的工作
因为我将不得不点击多达50张纸张join到一张。

到目前为止我的脚本提取数据,并设置一个计数器来抵消的位置
结果所以没有被覆盖。 但是,脚本完成后,我结束了
在一个例子中是1500个空行,然后是数据集的最后几行。 所以基本上我得到了1000个元素数据集的最后75行左右(在一种情况下是3)
不知道我在这里错过了什么。 Querytables是否总是将链接数据放在$ A $ 1中?

代码:

Sub getHistoricalData() Dim sheetname As String, url As String Dim x_wsnames As Range Dim ws As Worksheet, destinationRange As Range Dim fillRange As Range, cell As Range, startCell As Range, endCell As Range Dim operationalRange As Range, max As Integer Dim last_objid As Integer, m As Integer Dim startPage As Boolean, divider As String On Error Resume Next For Each x_wsnames In Sheets("data").Range("B2:B11") 'url = x_wsnames.Offset(0, 2).Value max = x_wsnames.Offset(0, 2).Value sheetname = x_wsnames.Value ' Sheets.Add.Name = sheetname Sheets(sheetname).Select Set ws = Sheets(sheetname) Select Case sheetname Case "A" position = "one" Case "B" position = "two" Case "C" position = "three" Case "D" position = "four" Case "E" position = "five" Case "F" position = "six" Case "G" position = "seven" Case "H" position = "eight" Case "I" position = "nine" Case "J" position = "ten" End Select Debug.Print "Processing cycleThroughWorksheets() " & sheetname m = 0 For i = 1 To max url = "http://dataplace/search?category=type&dataType=historical&locations=ALL&d-112233-w=" & i & "&filter=" & divider 'Debug.Print i, url If i = 1 Then Set destinationRange = Range("$A$1") Debug.Print destinationRange.Address Else m = m + 75 Set destinationRange = Range("$A$" & m) Debug.Print destinationRange.Address End If With ActiveSheet.QueryTables.Add(Connection:= _ "URL;" & url, destination:= _ destinationRange) .Name = sheetname .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .WebSelectionType = xlEntirePage .WebFormatting = xlWebFormattingNone .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With Next Next End Sub