Link to home
Start Free TrialLog in
Avatar of Andreas Hermle
Andreas HermleFlag for Germany

asked on

Insert first row in multiple excel files in given folder

Dear Experts:

I would like to run a macro that performs the following action:

I got hundreds of xlsm-files in C:\temp\

- I would like to insert a row at the very top of each workbook (each workbook contains just one worksheet named 'temp').

- This newly created first row has to have the following entries for A1, B1, C1, D1:
Item Number, Customer, Street, Items.

- The first row should be formatted to repeat with each page break (rows to repeat at top)

Help is much appreciated. Thank you very much in advance.

Regards, Andreas
ASKER CERTIFIED SOLUTION
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andreas Hermle

ASKER

Dear ssagibh:

thank you very much for your great help. Works great although I needed to make a slight change on the variable declaration:

Dim wb As Variant

And I added
wb.ActiveSheet.PageSetup.PrintTitleRows = "$1:$1" for the header to be repeated on page breaks.

Anyhow, thank you very much for your great and swift support. I really appreciate it.

Regards, Andreas