ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format cell based on adjacent cells values (https://www.excelbanter.com/excel-programming/348270-format-cell-based-adjacent-cells-values.html)

the majestic ferny

Format cell based on adjacent cells values
 
I searched through the group and saw that this is a fairly common
question, but I'm afraid I don't have enough skills with VB to edit
existing code to fit my needs. What I would like to have is workbook
code that would check the active worksheet and highlight cells in
column A (starting on the 4th row) if the adjacent cells in either
column B or C are empty. If values are added to both adjacent cells
then the highlighting is removed.
Any code samples, tips, anything at all is greatly appreciated.
Kind Regards.


Rowan Drummond[_3_]

Format cell based on adjacent cells values
 
You don't need any code for that, you can use Excel's built-in
conditional formatting.

Select the data in column A starting in Row4 that A4 is the activecell.
A4 should be white and you should see A4 in the namebox on the formulabar.
From the menus select FormatConditional Formatting.
Change the first dropdown box to "Formula Is".
Then enter the formula:
=OR(ISBLANK(B4),ISBLANK(C4))
Click on Format and select the formatting you want.
OK out.

Hope this helps
Rowan

the majestic ferny wrote:
I searched through the group and saw that this is a fairly common
question, but I'm afraid I don't have enough skills with VB to edit
existing code to fit my needs. What I would like to have is workbook
code that would check the active worksheet and highlight cells in
column A (starting on the 4th row) if the adjacent cells in either
column B or C are empty. If values are added to both adjacent cells
then the highlighting is removed.
Any code samples, tips, anything at all is greatly appreciated.
Kind Regards.


Gord Dibben

Format cell based on adjacent cells values
 
You sure you want to use VBA?

You can do what you want through Conditional Formatting easily.

Select A4 to An

FormatCFFormula is: =ISBLANK($B4)

Pick a color from FormatPatterns and OK your way out.


Gord Dibben Excel MVP

On 15 Dec 2005 16:32:52 -0800, "the majestic ferny"
wrote:

I searched through the group and saw that this is a fairly common
question, but I'm afraid I don't have enough skills with VB to edit
existing code to fit my needs. What I would like to have is workbook
code that would check the active worksheet and highlight cells in
column A (starting on the 4th row) if the adjacent cells in either
column B or C are empty. If values are added to both adjacent cells
then the highlighting is removed.
Any code samples, tips, anything at all is greatly appreciated.
Kind Regards.


the majestic ferny

Format cell based on adjacent cells values
 
Thanks for the advice Rowan & Gord! Just want I needed.
Kind Regards.


the majestic ferny

Format cell based on adjacent cells values
 
Thanks for this. I noticed that if I enter values in the adjacent B
and C cells, and then delete those values, the formatting doesn't
reappear. ???



All times are GMT +1. The time now is 10:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com