sub arnapsui()
Dim z As Long, e As Long, g As Long, d As Long, h As Long
Dim f As String
d = 2
Cells(1, 1) = "=cell(""filename"")"
Cells(1, 2) = "=left(A1,find(""["",A1)-1)"
Cells(2, 1).Select
f = Dir(Cells(1, 2) & "*.xls")
Do While Len(f) > 0
ActiveCell.Formula = f
ActiveCell.Offset(1, 0).Select
f = Dir()
Loop
For e = 2 To Range("A" & Rows.Count).End(xlUp).Row
If Cells(e, 1) <> ActiveWorkbook.Name Then
Cells(d, 2) = Cells(e, 1)
Cells(1, 4) = "=Counta('" & Cells(1, 2) & "[" & Cells(e, 1) & "]Sheet1'!B:B)"
For g = 2 To Cells(1, 4)
For h = 1 To 10
Cells(1, 3) = "='" & Cells(1, 2) & "[" & Cells(e, 1) & "]Sheet1'!" & Chr(h + 64) & g
Cells(d, h + 2) = Cells(1, 3)
Next h
d = d + 1
Next g
d = d + 1
End If
Next e
MsgBox "collating is complete."
end sub