[Excel 2007] Apply custom number format based on column header

woody3737

Board Regular
Joined
Sep 19, 2008
Messages
82
I have 4 different custom number formats that I use for various columns of data, one for currency, number, retail price, and percentage. I was wondering what the code might look like to have a macro search the column headers, in row 3, and based on what the column header is, it will apply a certain format, either to the entire column or just to the cells containing data. Either way would be ok. For example, if a column header is POS Sales, I would like it to apply the following format to the column:


Code:
"$#,##0_);[Red]($#,##0)"


I believe I'd be able to alter any suggested code to take into consideration all of the other header names. Thanks for any help.
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
I failed to mention that the header could also just contain POS Sales, such as "2008 POS Sales" & "2009 POS Sales"
 
Upvote 0

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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