Interior.Colorindex vs Conditional Formatting

tyija1995

Well-known Member
Joined
Feb 26, 2019
Messages
781
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I have made a command button that gives me a MsgBox of the active cells interior colorindex,

I notice the default is -4142.

When I make a cell yellow for example the command button returns 6

Now if I were to make the cell yellow using conditional formatting then test the command button I see -4142 again.

Is there anyway around this? Or does Excel not like this combination?

Thanks in advance!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Cells Interior color and Conditional formatting color is not the same.

What are you wanting?
The cells Interior color or the cells conditional formatting color.
-4142 means it has no interior color.
 
Upvote 0
The cells conditional formatting color in this case - wasn't sure if they were the same or not!
 
Upvote 0
If you want to know the color of a cell that has been colored by a conditional formatting then use

msgbox activecell.DisplayFormat.Interior.Color
 
Upvote 0

Forum statistics

Threads
1,215,850
Messages
6,127,282
Members
449,373
Latest member
jesus_eca

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