Link to home
Start Free TrialLog in
Avatar of Pancake_Effect
Pancake_EffectFlag for United States of America

asked on

Excel Macro: Replace Column Headers

We have a long macro that messes up some of the column titles on the very first row. We probably have close to 20 columns.


Instead of having the users copy and paste row 1 back in each time, is there a macro that I pre-make and have them run it to replace it back with the predefined data?

For example:

Title 1    Title 2    Title 3  Title 4

When we run the Macro1 it may look like:

56    al   bl   number

Because our macros look at the entire columns.


So if I can have a a Macro2 that the users would run after the first one, that changes it back to :

Title 1    Title 2    Title 3  Title 4

That would be great.

There is nothing special about the titles other than they are bold.
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
Has you thought about altering the macro to exclude your title row when it runs?
Avatar of Pancake_Effect

ASKER

ssaqibh works great!  Thank you so much.

borgunit - I'm not sure how to do that, I've been mostly just using what is provided to me on here. I'm a noob at it :(

You can take a look at my attached script, it's quite long and messy. But if I put ssaqibh's line of code on the bottom it takes care of the problem.
I guess my only concern was that the new info in the title row was necessary and/or if the macro sorted the title info to another place.
Thanks for the help.

This worked flawlessly.