VBA Code for background color (yellow)

Doppler17

New Member
Joined
Oct 4, 2017
Messages
1
My first task at hand is to check whether or not Column’s E thru K is shaded "yellow" or not based on conditional formatting formula used [E2<>O2] =$E$2:$K$1206. So in separate column, I’m using Column AB2 as starting point to check if E (is yellow), AC2 if F (yellow) and so forth to identify if each cell through this range is shaded yellow.

I have been using this VBA Code:

Function getColor(cell As Range)
getColor = cell.Interior.ColorIndex
End Function

And using this formula in my check column [AB] =if(getColor(a1)=6,”yellow”,”Blank”)

However the above if formula will only work with columns shaded manually.

D E F G H I J K
Application Name OptOut StartDate EndDate M1 M2 M3 M4 M5
App 1 N 10/1/2017 9/30/2017 100 100 100
App 2 N 3/1/2017 12/16/2017 100 100 50
App 3 N 3/23/2017 9/30/2017 100 100 100

Thank you for your help!
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Welcome to Mr Excel

In your formula try the same condition used in Conditional Formatting

AB2
=IF(E2<>O2,"yellow","blank")

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,223,104
Messages
6,170,125
Members
452,303
Latest member
c4cstore

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