Sub CreateFormulas()
Dim lastCol As Long
Dim lastRow As Long
Dim formName As String
Dim foldName As String
Dim fullPath As String
'Name of folder where source files are at
'Be sure to include closing backslash
foldName = "D:DocumentsClosing"
Application.ScreenUpdating = False
'Define the boundaries of worksheet
With ActiveSheet
lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
'Starting at column B (the 2nd column) and going to last col...
For i = 2 To lastCol
'Starting in row 2, and going to last row...
For j = 2 To lastRow
'Build the full folder & workbook path
fullPath = foldName & "[" & Cells(1, i).Value & ".xlsx]"
'Looking at end of formula, we're going to look in Sheet1
'Lookup value is in col A, return value is in col V
'Modify this as needed to match your situation
formName = "=VLOOKUP(A" & j & ",'" & fullPath & "Sheet1'!A:V,22,FALSE)"
Cells(j, i).Formula = formName
Next j
Next i
Application.ScreenUpdating = True
End Sub