View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
merlin merlin is offline
external usenet poster
 
Posts: 27
Default conditional formatting

Ah...macros are well beyond me I'm afraid.

I was hoping for a simple comparison phrase such as 'E1 OR E2 OR E3 OR E4'
but I can't seem to get that to work.

"FunkySquid" wrote in message
oups.com...
If you highlight the range of cells you want to colour, you could use
this code instead:

Sub ColourCells()
Const EColour As Integer = 7 'pink
Const MColour As Integer = 10 'Green
Const LColour As Integer = 5 'blue
Dim myCell As Range

For Each myCell In Selection
Select Case Left(myCell, 1)
Case "E"
myCell.Interior.ColorIndex = EColour
Case "M"
myCell.Interior.ColorIndex = MColour
Case "L"
myCell.Interior.ColorIndex = LColour
End Select
Next myCell

End Sub


FunkySquid

merlin wrote:
I had been formatting a cell colour to pink green or blue depending on if
it
contained E, M or L.

I've now had to change my cell contents to E1, E2, E3, E4 etc instead of
just 'E' so I've gone over my limit of 3 conditional formats.

Is there a way I can conditionally format based just on the letter E M or
L
and not the number with it?

Or can you think of another way to achieve the same thing?

Much obliged for any help suggested.