返回列表 上一主題 發帖

EXCEL 抓取另一個 EXCEL 空白出現0

回復 1# iwiniwin


    那就用查詢該欄的最後位址的方式去做

Sub 按鈕12_Click()
    Dim sPath As String
    sPath = ThisWorkbook.Path & "\"
   
    Workbooks.Open (sPath & "tmp.xlsx")
        ARow = Workbooks("tmp.xlsx").Sheets("tmp").Columns(1).Find("*", , , , , 2).Row
        CRow = Workbooks("tmp.xlsx").Sheets("tmp").Columns(3).Find("*", , , , , 2).Row
    Workbooks("tmp.xlsx").Close
   
    Range("A1:A" & ARow).FormulaArray = "='" & sPath & "[tmp.xlsx]tmp'!A1:A" & ARow
    Range("B1:B" & CRow).FormulaArray = "='" & sPath & "[tmp.xlsx]tmp'!C1:C" & CRow
   
End Sub

TOP

        靜思自在 : 口說好話、心想好意、身行好事。
返回列表 上一主題