各位好!
目前想要做的是
複製工作表"A"後
讓"B"工作表"C2"儲存格輸入的文字
能自動變成更換為 工作表的名稱 以及其 工作表裡唯一表格的名稱
(到這部分已完成)
接著想使用Power Query來抓取表格資料
但來源的地方是否只能輸入指定表格名稱?
想讓他能自動抓取當前Active的表格是可行的嗎?
(因每次的表格名稱會隨B!C2有所更動)
比如
來源 = Excel.CurrentWorkbook(){[Name=""表格A""]}[Content]
是否有機會是
來源 = Excel.CurrentWorkbook(){[Name=""表格" & ActiveSheet.Name"]}[Content]
來源 = Excel.CurrentWorkbook(){[Name=""表格" & A!C2"]}[Content]
(已知不可行)
麻煩各位協助了~謝謝!!!
Sheets("A").Copy Before:=Sheets(5)
Sheets("B").Select
Sheets(5).Name = Range("C2")
Sheets(5).Select
Range("G2").Select
ActiveSheet.ListObjects(1).Name = "表格" & ActiveSheet.Name
ActiveWorkbook.Queries.Add Name:="表格" & ActiveSheet.Name, Formula:= _
"let" & Chr(13) & "" & Chr(10) & " 來源 = Excel.CurrentWorkbook(){[Name=""表格A""]}[Content]," & Chr(13) & "" & Chr(10) & " 已變更類型 = Table.TransformColumnTypes(來源,{{""Product"", type any}, {""Size"", type any}, {""C"", type any}, {""Main Color"", type any}, {""Main"", type text}, {""Part"", type text}, {""Color"", type any}, {""Material"", type any}, {""Code"", type any}, {""Resin Color"", type any}, {""Color Code""," & _
" type any}, {""Finish"", type any}, {""Process"", type any}, {""Finish Note"", type any}, {""Paint Code(TYPIC)"", type any}, {""Code(PPG)"", type any}, {""Confirm"", type any}, {""Update Date"", type any}})," & Chr(13) & "" & Chr(10) & " 已篩選資料列 = Table.SelectRows(已變更類型, each ([Part] = ""A Cover"" or [Part] = ""B Bezel"" or [Part] = ""C Cover"" or [Part] = ""D Cover"" or [Part] = ""Hinge Cap" & _
"/Cover"" or [Part] = ""PWR key"" or [Part] = ""Strip Cover"" or [Part] = ""Vol key""))" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " 已篩選資料列"
是否一定要用 Power Query 呢? 見你大多是 ANY ,不如改個方法做