Format cells in column H based on text content in column C

Declamatory

Active Member
Joined
Nov 6, 2014
Messages
319
Good Day Everyone,

Is someone able to show me how to format cells in column H based on the text content in column C.

If part of the text in column C5 contains the text “GBP” then the format of H5 should be "$#,##0.00_);[Red]($#,##0.00)" (GBP currency format)

If part of the text in column C5 contains the text “USD” then the format of H5 should be "[$$-409]#,##0.00" (USD currency format)

The same rule should apply for all cells in column H. There will be some blank rows in the data. It doesn't matter how these cells are formatted as there is nothing in them.

I have tried using conditional formatting and this works fine when recording the macro but errors when running the macro. Is there another routine using VBA that would work.

Thanks

Dec
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Hi Rob, The code worked when the 500 rows was specified but the adjusted code doesn't work I'm, afraid. It has ignored some cells in column H and has made some cells that should be in USD format into GBP format and vice versa.
 
Upvote 0

Forum statistics

Threads
1,215,433
Messages
6,124,863
Members
449,195
Latest member
MoonDancer

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