Checkbox Conditional Formatting Referencing with Cell Color Counting Problem (Multiple Worksheets)

jerboz

New Member
Joined
Feb 7, 2020
Messages
1
Office Version
  1. 2007
Platform
  1. Windows
Hi,

So I am in the process of creating a spreadsheet for a business venture and I am using the spreadsheet as an internal worksheet for services that we provide.

On worksheet 1 I have an extensive list of services we provide. Each service is connected to a checkbox. Worksheet 2 is our service packages (we have over 26 packages), and there is a lot of overlap between services and our packages and for a good reason.

The way I have it set up is through conditional formatting on Worksheet 2, I connected all the services to the checkboxes on worksheet 1. When a service is selected on worksheet one, the same service is cell colored 'green' and up to this point it works perfectly. The problem that I am having is the most important part, depending on the services the clients desire will determine which package makes the most sense for them. I figured the best way to do this is to count the colored cells within each package and the highest number is the obvious choice, making our package selection super easy.

I have tried countif() functions to no avail. I am currently working with VBA and have this code in module 1:

Function ColorCount(rColor As Range, rRange As Range)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
ColorCount = vResult
End Function


I use =colorcount(range,reference color cell 'green') and it is not picking up the conditional formatting of my colored cells. I know that the problem is because of the conditional formatting because if i manually color cells this color count works perfectly. Just for additional info, the way that I did my conditional formatting is complicated. My services on worksheet 1 cannot be reference through conditional formatting, so I ended up specifically naming each cell that has a service i.e. cell A2 on worksheet 1 I named EWCA2 and cell A3... EWCA3 and so on. I then referenced those cells in conditional formatting and used cell color 'green'. I have spent hours on this and this is the first time using VBA, please help me whoever can.... thank you in advanced!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,224,827
Messages
6,181,195
Members
453,021
Latest member
pingpong7117

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