Formatting cell backgrounds based on cell contains

A

Amcdee

Hope someone can help with this little problem. Whilst I know it is
more than achievable I just can't seem to get my head round the
code.

The worksheet updates from a data source providing details of back
orders. Column "A" contains the customer number, the data is also
sorted on the column. So for alternative customer number we want to
shade the background of those cells therefore making it easier to
read.

Whilst I can find many examples of shading alternate row, I can't find
any for alternative blocks.

Hope that makes sense.

Many thanks in advance

Alan
 
G

Guest

I would add a new column let's say G. I also assume that the first row is for
headers and customer info starts at row 2. Put if G1 the value TRUE. Write
the formula on G2: =IF(A2=A1, G1, NOT(G1)) and copy it down the range. Now G
contains an alternance of TRUE and FALSE value. Select the whole range to
color, then use the conditional formatting (Menu Format > Conditional
Formatting), select "Formula Is" and type "=$G2=TRUE" (without the quotes).
 
A

Amcdee

I would add a new column let's say G. I also assume that the first row is for
headers and customer info starts at row 2. Put if G1 the value TRUE. Write
the formula on G2: =IF(A2=A1, G1, NOT(G1)) and copy it down the range. Now G
contains an alternance of TRUE and FALSE value. Select the whole range to
color, then use the conditional formatting (Menu Format > Conditional
Formatting), select "Formula Is" and type "=$G2=TRUE" (without the quotes).

Thanks Stephane but that is not quite what I want to do as the sheet
automatically updates it data.

What I'm looking for is a vba solution which can be placed in the
onChange event handler.

But many thanks for the suggestion.

Kindest regards

Alan Newton
 

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

Top