ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   row and cell highlighted (https://www.excelbanter.com/excel-worksheet-functions/236188-row-cell-highlighted.html)

Mr.Param[_2_]

row and cell highlighted
 
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

Jacob Skaria

row and cell highlighted
 
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
---------------
Jacob Skaria


"Mr.Param" wrote:

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


Mr.Param[_2_]

row and cell highlighted
 
Yes, it works. Thanks lot.

"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"Mr.Param" wrote:

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



All times are GMT +1. The time now is 06:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com