This is supposedly working code, but it doesn't work for me, and I don't understand how it's supposed to work. Can anyone help with that?
Edit: What I mean when I say I don't understand it is that all the variables are never defined. They're never linked to the function's arguments, so how can the code recognize where it's supposed to be looking to fill "fPath", "fName", "sName" and "cellRange"...?
A lot of the tips I'm finding to grab values from a closed workbook are like this. Nothing to set the variables, I don't get how that can work.
Code:
GetValuesFromAClosedWorkbook "C:", "Book1.xls", _
"Sheet1", "A1:K30"
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
Edit: What I mean when I say I don't understand it is that all the variables are never defined. They're never linked to the function's arguments, so how can the code recognize where it's supposed to be looking to fill "fPath", "fName", "sName" and "cellRange"...?
A lot of the tips I'm finding to grab values from a closed workbook are like this. Nothing to set the variables, I don't get how that can work.
Last edited: