View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
robert morris robert morris is offline
external usenet poster
 
Posts: 222
Default Conditional Formatting of Entire Row when the Active Cell is i


L. Howard,

I'm just trying to learn and like your VBA. What would I change if I had a
Range of B8:G25 ?

Bob M.


"L. Howard Kittle" wrote:

Hi again Shannon,

Perhaps in the future you may want to highlight a row but contain it in a
certain range. Try this, which I believe I authored. Click on any cell in
range B8:K22 and that row will be highlighted From columns B to K.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Data As Range
Dim i As Integer
Dim j As Integer
Dim k As Integer
i = 2
j = 8
k = ActiveCell.Column()
Set Data = Range("B8:K22")

Data.Interior.ColorIndex = xlNone

If ActiveCell.Row < 8 Or ActiveCell.Row 22 Or _
ActiveCell.Column < 2 Or ActiveCell.Column 11 Then
Exit Sub
End If

ActiveCell.Offset(0, -(k - i)). _
Resize(1, 10).Interior.ColorIndex = 35

End Sub

HTH
Regards,
Howard

"Shannon" wrote in message
...

I would like to highlight/shade the entire row that currently has the
active/selected cell. For example, whenever I am anywhere on row 10 I
would
like all of row 10 to be highlighted or shaded a certain colour. I have
been
looking for a function like ACTIVEROW or ACTIVECELL so that I can then use
conditional formatting, but can't find anything.

I am using EXCEL 2007.

Please help. Thanks.