View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Simon Simon is offline
external usenet poster
 
Posts: 172
Default conditional format rage based on entries within range

Hi Don,
Thanks.
I have no idea what the code means but it works.
The only time the cells don't revert back to red if the range is empty is
when two or more cells are selected at the same time and the data is deleted
en mass rather than one cell at a time, in this instance the now empty range
remains un formatted - certainly not the end of the world for me, as once the
data is entered there should be no need to delete it, but thtought you might
be interested. Also, as with all novices' I haven't given the complete
picture - there are other cell ranges in the spreadsheet that I would like
formatting to different colours depending on whether the range is blank or
not, I tryed to duplicate your formula below the origonal I had entered but
excel returned an error and (don't mean to be greedy), is there anything I
can add to your code to repeat the command down the columns of the data range
for a (monthly) list of varying length. Or should I stick to looking for a
conditional format solution?
Cheers.
Simon.

"Don Guillett" wrote:

Instead of CF try this worksheet change event that will color if all TRULY
blank
Right click sheet tabview codeinsert this
'--------
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myrange As Range
Set myrange = Range("b1:d4")
If Intersect(Target, myrange) Is Nothing Then Exit Sub
If Target.Count 1 Then Exit Sub
If Len(Application.Trim(Target)) < 1 Then
Application.EnableEvents = False
Target = ""
Application.EnableEvents = True
End If
If Application.CountA(myrange) = 0 Then
myrange.Interior.ColorIndex = 3
Else
myrange.Interior.ColorIndex = -4142
End If
End Sub
'=======
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Simon" wrote in message
...
I have a spreadsheet in excel 2003 where a range of cells contain different
text.

If there is no text in any of the cells within the range I would like the
range conditionally formated (red), however if any or all of the cells
within
the range contain text then no format should be applied;e.g.

If A1 to D1 are blank format cells red, when text is entered into B1
remove
formatting.

All help greatly recieved.
Simon.


.