Try this
Sub Fill_Across()
'ENTERS AND FILLS A FORMULA ACROSS
Dim lngLastColumn As Long, i As Long
With Worksheets(1)
lngLastColumn = .Range("IV1").End(xlToLeft).Column
For i = 52 To lngLastColumn
.Range(.Cells(2, i), .Cells(10, i)).Formula = "=VLOOKUP(C2,$B$2:$I$1000," & i & ",0)"
Next i
End With
End Sub
It will check for the last column based on what is populated in the 1st row.
Then it loops populating each column. Note the formula also, has the i there to allow it to loop through the columns.
Bookmarks