Need to format cells based on content of itself and other cells

  • Thread starter Thread starter druk
  • Start date Start date
D

druk

Hi, I need to do the following:

If all cells in a certain range are blank, make their background color
blue.
If one of those cells is filled in, make the background color of all
the cells in the range white again.

I'd like this to be automatic, that is, if all cells in the range are
blank and I fill in one of them, when I press enter I'd like it to turn
white along with the rest of the cells in the range.

Likewise, if I delete the content of the only non-empty cell in the
range, I'd like it to turn blue along with the rest of the cells.

If this doesn't make sense, please ask for clarification. Thank you.
 
Hi
a non VBA solution
- e.g. select A1:F1
- goto 'Format - Conditional format'
- enter the formula
=COUNTA($A1:$F1)=0
- choose your blue background as format
 
if your range has a name, use a procedure to run each time
you update the a cell.

Private Sub Worksheet_Change(ByVal Target As Range)
MsgBox "I was changed"
End Sub

You might have to change the default action of the enter
key also. Change it so it will not move down once the
user presses it. Then read the cell's content and change
the color.
 
Your solution seems logical to me, but when I tried it, the followin
happened:

Blank cells turned blue even if other cells in the range wher
non-empty.
Likewise, only the cell you fill in turns white, while the other cell
in the range (which are blank) remain blue.

Any ideas?



Frank said:
Hi
a non VBA solution
- e.g. select A1:F1
- goto 'Format - Conditional format'
- enter the formula
=COUNTA($A1:$F1)=0
- choose your blue background as format
 
Hi
which cell did you select?. nd which formula did you exactly enter

--
Regards
Frank Kabel
Frankfurt, Germany

druk > said:
Your solution seems logical to me, but when I tried it, the following
happened:

Blank cells turned blue even if other cells in the range where
non-empty.
Likewise, only the cell you fill in turns white, while the other cells
in the range (which are blank) remain blue.

Any ideas?



Frank said:
Hi
a non VBA solution
- e.g. select A1:F1
- goto 'Format - Conditional format'
- enter the formula
=COUNTA($A1:$F1)=0
- choose your blue background as format

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top