Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default conditional formatting

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default conditional formatting

How about using a formula of

=UPPER(LEFT(A1,1))="E"

etc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default conditional formatting

will that work in the conditional formatting statement? I think it has to be
generic so I'm not sure how to reference the cell it applies to in that
context.


"Bob Phillips" wrote in message
...
How about using a formula of

=UPPER(LEFT(A1,1))="E"

etc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
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.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default conditional formatting

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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
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.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default conditional formatting

Conditional formatting can be done in a non-generic way. What you do
is format with Bob's code in cell A1, and then use the format painter
to copy the conditional formatting to the remaining cells below. The
A1 reference will automatically update to B1, C1, D1.... as the
formatting is painted on down.


merlin wrote:
will that work in the conditional formatting statement? I think it has to be
generic so I'm not sure how to reference the cell it applies to in that
context.


"Bob Phillips" wrote in message
...
How about using a formula of

=UPPER(LEFT(A1,1))="E"

etc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
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.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default conditional formatting

Conditional formatting can be done in a non-generic way. What you do
is format with Bob's code in cell A1, and then use the format painter
to copy the conditional formatting to the remaining cells below. The
A1 reference will automatically update to B1, C1, D1.... as the
formatting is painted on down.


merlin wrote:
will that work in the conditional formatting statement? I think it has to be
generic so I'm not sure how to reference the cell it applies to in that
context.


"Bob Phillips" wrote in message
...
How about using a formula of

=UPPER(LEFT(A1,1))="E"

etc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
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.





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default conditional formatting

OK - halfway there.

The cell references are updating but the cell colour isn't changing.

My first cell of data (top left) is D5 so my statement reads:

=UPPER(LEFT(D5,1))="E"


"lightspeed" wrote in message
ups.com...
Conditional formatting can be done in a non-generic way. What you do
is format with Bob's code in cell A1, and then use the format painter
to copy the conditional formatting to the remaining cells below. The
A1 reference will automatically update to B1, C1, D1.... as the
formatting is painted on down.


merlin wrote:
will that work in the conditional formatting statement? I think it has to
be
generic so I'm not sure how to reference the cell it applies to in that
context.


"Bob Phillips" wrote in message
...
How about using a formula of

=UPPER(LEFT(A1,1))="E"

etc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
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.







  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default conditional formatting

Yes it will, just select all of your target cells (I have assumed A1 is the
first selected), and then in CF change Condition1 to Formula Is, and add the
formula.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
will that work in the conditional formatting statement? I think it has to

be
generic so I'm not sure how to reference the cell it applies to in that
context.


"Bob Phillips" wrote in message
...
How about using a formula of

=UPPER(LEFT(A1,1))="E"

etc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
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.








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

Magic!

I didn't realise the 'formula is' referred to the condition - I thought it
referred to the nature of the cell contents.

You're all brilliant - thanks to all who dug me out of that one...

"Bob Phillips" wrote in message
...
Yes it will, just select all of your target cells (I have assumed A1 is
the
first selected), and then in CF change Condition1 to Formula Is, and add
the
formula.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
will that work in the conditional formatting statement? I think it has to

be
generic so I'm not sure how to reference the cell it applies to in that
context.


"Bob Phillips" wrote in message
...
How about using a formula of

=UPPER(LEFT(A1,1))="E"

etc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"merlin" wrote in message
...
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.










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting Conditional Formatting Icon Sets The Rook[_2_] Excel Discussion (Misc queries) 3 March 7th 09 08:48 PM
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"