Macro to Change Header Based on Column Contents

Michael151

Board Regular
Joined
Sep 20, 2010
Messages
247
Hello all,

Trying to write a macro that will change the header (row 1) of a column based on the contents of that column.

I have a column called “Medium Type” – this column can be in any column letter, which is why I’d like to use the header in row 1 to identify.

I have four separate formats that can be included in this column: Format1, Format2, Format3, and Format4. They will never be mixed together (only 1 format per sheet).

What I’d like is for the macro to identify which format is contained in the “Medium Type” column and change the header in row 1 to that format.

For example:

Before:

Medium Type
Format1
Format1
Format1

After:

Format1
Format1
Format1
Format1

In my example above, the header in row 1 is highlighted in blue. Any help is appreciated! Thank you!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
It would be something like:

Find: "Medium Type" in row 1

Look down column containing "Medium Type"

Find either Format1, Format2, Format3 or Format4

Change header in row 1 from "Medium Type" to Format Type Found
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top