Wouldn't confess to having looked at this in great depth but perhaps:
Sub pop_report()
' Set array length = 30
Dim vaCells(1 To 30)
Dim numberofemployees As Long, a As Long, e As Long, rownumber As Long, b As Long
Dim emprow As Variant
Dim empname As String, emppath As String, empfile As String, empfullpath As String
' Read no. of employees from excel cell
numberofemployees = Sheets("Report_Standard").Range("D4").Value
' Start at first employee, finish at last
For a = 1 To numberofemployees
' Set array number to 1
e = 1
' 15 rows above start of employee list, so a + 16 gives 1st employee
rownumber = a + 16
'employee name in column A
empname = Cells(rownumber, 1).Value
'find employee name in employee database sheet
emprow = Application.Match(empname, Worksheets("Employee List").Columns(2), 0)
'on that sheet find the path to their file
emppath = Sheets("Employee List").Cells(emprow, 3).Value
'on that sheet find filename of their file
empfile = Sheets("Employee List").Cells(emprow, 4).Value
'combine for full path
empfullpath = emppath & empfile
'open employee sheet
Workbooks.Open (empfullpath)
'keep looping until c becomes anything but 0
For b = 11 To Worksheets(1).Cells(Rows.Count, "A").End(xlUp).Row Step 1
'If workcode isnt blank
If Workbooks(empfile).Worksheets(1).Cells(b, 1) <> "" Then
'If work has not been completed
If UCase(Worksheets(1).Cells(b, 16).Value) <> "Y" Then
' store workcode in array position e
vaCells(e) = Worksheets(1).Cells(b, 1).Value
' increment e
e = e + 1
End If
End If
Next b
' Close File
ActiveWorkbook.Close False
' Write array into horizontal cells from B17 onwards
Workbooks("NCR_tracking_sheet V101.xls").Worksheets("SICAM SAS 2009").Range("B17:AE17") = Application.Transpose(vaCells)
' Next employee
Next a
End Sub
Bookmarks