I was hoping to find a way to do this without using a macro, but I doubt this is possible, anyway I managed to do this in the meantime, Hans from Microsoft Answers kindly provided the code for the following macro which does just what I was asking for:
Sub SetHeaderRow()
Dim strPath As String
Dim strFile As String
Dim wbk As Workbook
Dim wsh As Worksheet
' Let user select a folder
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show Then
strPath = .SelectedItems(1)
Else
MsgBox "No folder selected", vbInformation
Exit Sub
End If
End With
Application.ScreenUpdating = False
If Right(strPath, 1) <> "\" Then
strPath = strPath & "\"
End If
' Loop through the Excel workbooks in the folder
strFile = Dir(strPath & "*.xls*")
Do While strFile <> ""
' Open the workbook
Set wbk = Workbooks.Open(Filename:=strPath & strFile, AddToMRU:=False)
' Loop through the worksheets in the workbook
For Each wsh In wbk.Worksheets
' Insert row
wsh.Range("A1").EntireRow.Insert
' Set some values
wsh.Range("A1") = "This"
wsh.Range("B1") = "That"
' ...
wsh.Range("L1") = "Finally"
Next wsh
' Save and close the workbook
wbk.Close SaveChanges:=True
' On to the next
strFile = Dir
Loop
Application.ScreenUpdating = True
End Sub
Thanks again Marcol, and again apologies for the cross-posting.
Bookmarks