Use VBA instead of Conditional Formatting for cell color

Sleeplol

Board Regular
Joined
Apr 10, 2019
Messages
194
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello All,

How could I replace Conditional Formatting with a VBA solution?
If any value within Worksheets("Remove_Reassign").Range("G42:O60") matches a value within table header "Merged" in table ThisWorkbook.Connections("Query - GroupAgnT1") (Table on sheet GroupAssignTable) then that cell is filled with vbGreen???

Conditional formatting looks great and is fast but doesn't work with the SelectionChange events that need to run when cells within the above range are clicked. If the cell ColorIndex is vbGreen (4) then Macro1; else if ColorIndex is 0 then Macro2.

Thanks for any help with this
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Instead of checking the ColorIndex in the SelectionChange event, can you check to see if the cell matches the same formula/criteria as the conditional format that made it green? It seems like if you make a macro to test the cell to see if it qualifies to be green, make it green, and then test for it being green later, you could test the cell qualification directly.
 
Upvote 0
Hi shknbk2,
That's a great idea. I'll make a dummy range for G42:O60, like G73:O91 with this formula IF(ISERROR(VLOOKUP(G42,GroupAssignTable!$AE$6:$AE$4877,1,FALSE)),FALSE,TRUE)
Before I had CF change the color to green if True. But per your suggestion, I'll run a macro to change all True in the range to vbGreen
 
Upvote 0

Forum statistics

Threads
1,215,067
Messages
6,122,949
Members
449,095
Latest member
nmaske

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