row and cell highlighted

  • Thread starter Thread starter Mr.Param
  • Start date Start date
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
 
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
 
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
 
Back
Top