Highlight a Cell When Working in Another Cell

T

TKrepitch

If I am working in, say, cell B5, is there a way I can have cell G5
highlighted?

When I am inputting numbers into column B, there are instructions in
column G that I would like to have highlighted so that the instructions
for that particular row are easier to read.

I can't think of a good way to do this. I'd appreciate any ideas.
Thanks!
 
B

Bob Phillips

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.FormatConditions.Delete
With Target
If .Column = 2 Then
.Offset(0, 5).FormatConditions.Add Type:=xlExpression,
Formula1:="TRUE"
With .Offset(0, 5).FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
End With
.Offset(0, 5).FormatConditions(1).Interior.ColorIndex = 20
End If
End With

End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
B

Bob Phillips

Probably wrap-around. Try this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.FormatConditions.Delete
With Target
If .Column = 2 Then
.Offset(0, 5).FormatConditions.Add Type:=xlExpression, _
Formula1:="TRUE"
With .Offset(0, 5).FormatConditions(1)
With .Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
With .Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = 5
End With
End With
.Offset(0, 5).FormatConditions(1).Interior.ColorIndex = 20
End If
End With

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Top