Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users
Sub Host03GetValue() p = "c:\Test\" 'p is the path to the document' f = "HOST03.xls" 'f is the filename of the excel sheet' s = "tabvInfo" 's is the sheet name' a = "A16" 'a is the reference cell' Application.ScreenUpdating = False For r = 2 To 42 For c = 1 To 1 a = Cells(r, c).Address Cells(r + 8, c + 1) = GetValue(p, f, s, a) Next c Next r Application.ScreenUpdating = True End Sub
Public Function GetValue(path, file, sheet, ref) ' Retrieves a value from a closed workbook Dim arg As String ' Make sure the file exists If Right(path, 1) <> "\" Then path = path & "\" If Dir(path & file) = "" Then GetValue = "File Not Found" Exit Function End If ' Create the argument arg = "'" & path & "[" & file & "]" & sheet & "'!" & _ Range(ref).Range("A1").Address(, , xlR1C1) ' Execute an XLM macro GetValue = ExecuteExcel4Macro(arg) End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.