Hi,
I created a code to return value of a destinated cell from a list of closed workbooks in a folder. Now my question is how do I alternate the code to "search" through to return a destinated value? The difference is that for the current solution, I must know my destinated cell ahead of time, when in reality, I don't know where it is due to differences in different excel sheets.
Thank you for your help. - Amy
Private Function GetInfoFromClosedFile(ByVal wbPath As String, _
wbName As String, wsName As String, cellRef As String) As Variant
Dim arg As String
GetInfoFromClosedFile = ""
If Right(wbPath, 1) <> "\" Then wbPath = wbPath & "\"
If Dir(wbPath & "\" & wbName) = "" Then Exit Function
arg = "'" & wbPath & "[" & wbName & "]" & _
wsName & "'!" & Range(cellRef).Address(True, True, xlR1C1)
On Error Resume Next
GetInfoFromClosedFile = ExecuteExcel4Macro(arg)
End Function
Bookmarks