row and cell highlighted

M

Mr.Param

Hi,

currently I am using this command:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlColorIndexNone
Target.EntireRow.Interior.ColorIndex = 36
End Sub

I would like to:

1. highlight only certain range e.g A2:AK81
2. highlighted cell change with different color
3. keep my shading color

TQ
 
J

Jacob Skaria

Hi Mr.Param

Modified to suit your requirement. Try and feedback. You can try out
different color to suit your requirement.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target, _
Range("A2:AK81")) Is Nothing Then
Range("A2:AK81").Interior.ColorIndex = -4142
Range("A" & Target.Row & ":AK" & _
Target.Row).Interior.ColorIndex = 35
Target.Cells.Interior.ColorIndex = 6
End If
End Sub

If this post helps click Yes
 
M

Mr.Param

Yes, it works. Thanks lot.

Jacob Skaria said:
Hi Mr.Param

Modified to suit your requirement. Try and feedback. You can try out
different color to suit your requirement.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Target, _
Range("A2:AK81")) Is Nothing Then
Range("A2:AK81").Interior.ColorIndex = -4142
Range("A" & Target.Row & ":AK" & _
Target.Row).Interior.ColorIndex = 35
Target.Cells.Interior.ColorIndex = 6
End If
End Sub

If this post helps click Yes
 

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