This will loop through all excel files in a folder, insert four columns, and add headers.
Change the folder and headers to suit.
First test this on a folder with a few test files.
Sub Insert_Columns_All_Files()
Dim strPath As String, strFile As String, Counter As Long
strPath = "C:\Test\"
strFile = Dir$(strPath & "*.xls*", vbNormal)
Application.ScreenUpdating = False
Do While Len(strFile)
Counter = Counter + 1
With Workbooks.Open(strPath & strFile)
With .Sheets(1)
.Columns("I:L").Insert
.Range("I1:L1").Value = Array("Header 1", "Header 2", "Header 3", "Header 4")
End With
.Close SaveChanges:=True
End With
strFile = Dir$
Loop
Application.ScreenUpdating = True
MsgBox Counter & " files proceesed. ", , "Insert Columns Complete"
End Sub
Bookmarks