![Data Set][1]我有一个GetValues from a Closed Workbook的宏。宏工作并为我获取数据,但我缺少如何使其仅获取帐户 P 15178 的任何数据。源数据包含 5 个帐户,但我只需要获取一个帐户。帐号列在源数据的“A”列中。
这是我到目前为止所拥有的:
Sub test()
GetValuesFromAClosedWorkbook "H:\VBA", "DNAV.xlsx", "DNAV", "A1:F250"
End Sub
Sub GetValuesFromAClosedWorkbook(fPath As String, _
fName As String, sName, cellRange As String)
With ActiveSheet.Range(cellRange)
.FormulaArray = "='" & fPath & "\[" & fName & "]" _
& sName & "'!" & cellRange
.Value = .Value
End With
End Sub
数据集: