I have created a spreadsheet called Links.xls
The Tab name is also Links
Col A Col B
Department Link
A 378
B 8478
C 5778
D 3078
Row 1 Holds the Title The Data begins in Row 2
Enter in a continuos list all the Departments (ie Filenames) excluding the .xls qualifier
Then in VB (Alt +F11)
Paste the following macro into the module.
Sub Link_It()
Application.ScreenUpdating = False
Sheets("Links").Select
Range("A2").Select
Selection.End(xlDown).Select
curref = Selection.Address
lstrow = Right(curref, Len(curref) - 3)
For rowno = 2 To lstrow
Windows("Links.xls").Activate
deptrng = "Links!A" & rowno
lnkcell = "B" & rowno
deptfil = Range(deptrng).Value
deptfil2 = deptfil & ".xls"
Workbooks.Open FileName:=deptfil2
deptform = "=[" & deptfil & ".xls]Sheet1!R32C3"
Windows("Links.xls").Activate
Range(lnkcell).FormulaR1C1 = deptform
Workbooks(deptfil2).Close
Next
Application.ScreenUpdating = True
End Sub
Notes:
All the department files must be in the same (current) directory as must the linked (consolidating file).
The macro goes through each of your departments until the end of the continuous list is reached.
The macro will open and close these files as needed.
I hope this helps.
Sean
s-o-s@lineone.net