需要帮助获得结果到一个特定的标签

您好,我正在尝试获取下面的代码来将此查询的结果打印到Excel文档中不同的选项卡,所以我可以在摘要页面上有一个button,并将结果导出到特定的选项卡。 一切工作正常导入到macros的标签,但不想打印到一个单独的工作表。 任何帮助将是伟大的!

Cells.Select Range("A3").Activate Selection.ClearContents Range("A3").Select ActiveWorkbook.Queries.Add Name:="Query1" & Now, Formula:= _ "let" & Chr(13) & "" & Chr(10) & " Source = Csv.Document(Web.Contents(""website""),[Delimiter="","", Columns=15, Encoding=1252, QuoteStyle=QuoteStyle.None])," & Chr(13) & "" & Chr(10) & " " & _ " #""Promoted Headers"" = Table.PromoteHeaders(Source)," & Chr(13) & "" & Chr(10) & " #""Changed Type"" = Table.TransformColumnTypes(#""Promoted Headers"",{{""Issue Type"", type text}, {""Custom field (Epic Name)"", type text}, {""Summary"", type text}, {""Assignee"", type text}, {""Reporter"", type text}, {""Status"", type text}, {""Resolution"", type text}, {""Created"", type datetime}, {" & _ """Updated"", type datetime}, {""Due Date"", type datetime}, {""Component/s"", type text}, {""Component/s_1"", type text}, {""Component/s_2"", type text}, {""Custom field (Status Update)"", type text}, {""Custom field (Epic Link)"", type text}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Changed Type""" With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _ "OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=Query1" _ , Destination:=Range("$A$2")).QueryTable .CommandType = xlCmdSql .CommandText = Array("SELECT * FROM [Query1]") .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = False .ListObject.DisplayName = "Query1" .Refresh BackgroundQuery:=False End With Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False Application.CommandBars("Workbook Queries").Visible = False While ActiveSheet.QueryTables.Count ActiveSheet.QueryTables(1).Delete Wend 

结束小组

假设你想打印结果到Sheet2,你可以尝试改变它:

 , Destination:=Range("$A$2")).QueryTable 

对此:

 , Destination:=Sheet2.Range("$A$2")).QueryTable