Format cell on change and reset format on previous cell

bs0d

Well-known Member
Joined
Dec 29, 2006
Messages
622
Heres what I would like to do:

Anytime a user clicks within specified cell ranges:

Format current cell to draw focus.

Then when another cell is activated (or at focus):

The previous cell is returned to its former format, and new format applied to current cell.


So I need find out how to store the current cells format, replace it with new format (like a yellow background). And when a new cell is selected, reapply original format to previous selected well, and repeat for newly selected cell.

Any thoughts on this? I was able to color the current cell easy enough, but having troubles even detecting previous cell properly.
 
Last edited:

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.
I found this similar thread: http://www.mrexcel.com/forum/showthread.php?t=16684&page=2

And I have something working where you click a cell and the background color is set (to yellow), and the previous active cell format is cleared - so only the active cell has a yellow highlight.

The remaining problem is that errors are produced when you protect the sheet, and only want this to apply to unlocked cells.

Also, on the "previous active cell"- it would be nice to restore the original format of the cell, instead of just clearing it.

Thanks
 
Upvote 0
Ok I'm progressing through this.

I added a condition to only apply the formatting if the cell is unlocked.

The latest error is that when the sheet is in protection mode, it still prevents the cell formatting eventhough its unlocked. It seems a bit backwards...


I need to protect the sheet from user-formatting for locked cells only
 
Upvote 0
Ok I've chronicled my own solution here. Best thing I found to do was unprotect sheet in code, do what I need to do, and re-protect it.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,280
Members
452,902
Latest member
Knuddeluff

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