Code:
Private Function Update(path, file, sheet, value)
Dim theArgument As String
theArgument = "'" & path & "[" & file & "]" & sheet & _
"'!" & Range(value).Range("A1").Address(, , xlR1C1)
Update = ExecuteExcel4Macro(theArgument)
End Function
Code:
Sub Updater()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
thePath = "x:\thepath\"<o:p></o:p>
theFile = "Inventory Updater.xls"<o:p></o:p>
theSheet = "Media"<o:p></o:p>
theValue = "O2"<o:p></o:p>
ThisWorkbook.Sheets("Media").Range("a1").value = Update(thePath, theFile, theSheet, theValue)<o:p></o:p>
<o:p> </o:p>
End Sub
I've been using this code to get values from a closed workbook. The only problem is that I'm only able to get values from one cell at a time. If I try to get values from hundreds of cells, there's a lot of latency.
I'd like to know how to get some code like this to work with a range instead of targeting a single cell. Anyone know where I should go from here?