Slightly tricky conditional formatting

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
I have this code I want it to do a job for me but it's not finishing it properly.

Code:
Dim eCell As Range
For Each eCell In [E5:E18]
          eCell.Offset(eCell.Row-5, -1).Font.Color = eCell.Font.Color
           eCell.Offset(eCell.Row-5, -3).Font.Color = eCell.Font.Color
Next eCell

The aim is to make the font colors of the row from col B to Col D same as the the font color in E. Meanwhile col C is excluded.

I am using a conditional formatting for col E.

I am in for a better way to get this done.

Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
If you wants to 'recopy' color of cell which is results of Conditional Formatting is not a way.
It could works (not tested) for hardcoded color.
 
Upvote 0
Okay

So I decide to avoid the conditional formatting and used a code to set the font colors.

It's working now just that I am having issues with the offset.

The font color in col E does not match the B and D.
 
Upvote 0
Based on your OP using CF, how about
Code:
Dim eCell As Range
For Each eCell In [E5:E18]
          eCell.Offset(, -3).Font.Color = eCell.DisplayFormat.Font.Color
         eCell.Offset(, -1).Font.Color = eCell.DisplayFormat.Font.Color
Next eCell
But wouldn't it be easier to do it conditional formatting?
 
Last edited:
Upvote 0
@Fluff, it worked great!!!

As with the conditional formatting I am stacked. you can point me to that direction so I decide which will be sweet for me.:cool:
 
Upvote 0
What formula are you using for the CF?
 
Upvote 0
I used
="$E5<>YES"
while selecting the various columns
 
Upvote 0
If you select B5:B18 and D5:E18 then use
=$E5="YES"
that should format all three columns if col E=YES
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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