Excel Conditional Formatting Formula to change fill colour based on position of active cell

rasinc

Board Regular
Joined
Jun 28, 2011
Messages
131
I'm looking for a conditional formatting formula to change the fill colour of some cells based on the position of the active selected cell.
eg. if the currently active cell is K1, I would like to change the fill for A1:C3 but if the user selects cell J1, I would like A1:I1 to be filled in a different colour (can be the same colour as before) but the original A1:C3 goes back to "unselected" regular display with no fill.

A second use of the same concept is to highlight by fill the active row. User cursors down from row 1 to row 2, then row one should go back to uncoloured fill and row two should be billed. If the user selects a any cell in row 12, then row 12 should change fill.

I'm think I could figure out how to do this with VBA but I would like to avoid macros in this workbook. Also, for clarity, I am not concerned by what is in the active cell. The contents of the cells are irrelevant, it is the cell itself in the first example or the row of the cell that should trigger the change, not the contents.

I've tried to find this info but everything I find is dependent on what seems to be in the cell.

TIA rasinc
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Conditional formatting is all about cell content. I think you might need to go for a macro attached to a sheet event selectionChange() You can then apply a format to a range of cells relative to the selected cell. If you wanted to have the formatting based on a value entered by the user then yes conditional formatting for sure
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,118
Members
453,021
Latest member
Justyna P

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