Conditional Formatting-Referencing adjacent cell

C

cougarflank

I want to format my spreadsheet so that when a cell has an "a" in it and is
colored red, the cell immediately to its right will also be colored red. Is
this possible through conditional formatting or VBA? Thanks.
 
J

John C

What makes the cell colored red? If it is conditional formatting for that
cell, you can just include that in the next cell as well.

B2: =AND(A1>0,A2>0) ... formatted as red
C2: =AND(A1>0,A2>0,B2="a") ... formatted as red
 
C

cougarflank

I would like to make it so that I can just set the conditional format for the
whole spreadsheet. So when an "a" is entered into any cell, the cell next to
it automatically is colored red as well.
 
J

John C

Do you have conditional formats already? If you have xl2003 or earlier
version, have you hit your limit of 3? Is there ANY other situation where
cell might get highlighted as something else (and should be)?

If not, select columns B thru whatever is the end of your data, the active
cell should be B1.
Condition 1 change to Formula is: =A1="a"
Condition 2 should be whatever your original criteria for highlighting a
cell red.

Hope this helps.
 
D

Don Guillett

Right click sheet tab>view code>copy/paste this. Should do what is desired.

Private Sub Worksheet_Change(ByVal Target As Range)
If UCase(Target) = "A" And Target.Interior.ColorIndex = 3 Then
Target.Offset(, 1).Interior.ColorIndex = 3
End If
End Sub
 
G

Gord Dibben

Select Columns B:M or wherever

Format>CF>Formula is:

=OFFSET(B1,0, -1)="a"

Format to red.


Gord Dibben MS Excel MVP
 
Top