VBA Highlight Cell Based On Row Color

mayoung

Active Member
Joined
Mar 26, 2014
Messages
257
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I need some help with some code. See Attached link to work book. I have added buttons to the worksheet so you can run the code and see what it does.
The actual data is downloaded from a database using a file transfer program, so the number of rows varies all the time.
What I am trying to accomplish is filter column B by color lets say yellow then filter column C to show all cells with no color.
Then fill in the row color of Yellow in column C if column C is does not already have a color of Light Blue.
Which filtering column C to show only cells with no color should remove any that have a cell color of light blue.

The code repeats to then do the rose color.

In the example I have provided after running the code, Cell C11 should be yellow and cell C16 should be rose color.

My problem is if you push the button the several times it will highlight cell C1 in the header which can never happen. Also it highlights all empty cells below the last row of data which can never happen.

Is there an easier way of doing this?? Or can someone help me modify the code I already have.

Link To Work Book
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,653
Messages
6,120,756
Members
448,990
Latest member
Buzzlightyear

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