2016-06-08 132 views
3

需要從相應月份的另一個工作簿的單元格中獲取與特定客戶端對應的數據,每個月添加一個新工作表,例如「01.2016」,「02.2016」,「03.2016」Excel VBA函數獲取另一個工作簿的數據

我可以使用VBA功能自動化嗎?

Function GetSUM() 

    Dim strPath, strFile, strSheet, strRng, strRef, Result As String 

    strPath = "\\Report_2016" 
    strFile = "File_name_2016.xls" 
    strSheet = "06.2016" 
    strRng = Range("C59").Address(3, 59, xlR1C1) 

    strRef = "'" & strPath & "[" & strFile & "]" & strSheet & "'!" & strRng 

    End Function 

在此先感謝

+0

'GetSUM'沒有返回任何東西,有什麼功能的點,如果你不沒有通過任何東西,並在內部硬編碼? – findwindow

+0

從我所看到的,你引用其他工作表的語法是100% – durbnpoisn

回答

0

你錯過了之前的一首「\」「[」

strRef = "'" & strPath & "\[" & strFile & "]" & strSheet & "'!" & strRng 
+0

@daba你通過它了嗎? – user3598756

相關問題