ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Morning,
I am using the code below where when a cell is selected then that cells interior color changes from yellow to blue.
When i then slected another cell this previously selected cell then reverts back to yellow.
You will see that column D and H have there own specific color & do not change to blue.
Please can you advise how to edit the code so when the is cell is selected it now turns that row blue as opposed to just that cell.
Still column D and H would have there own specific color
I am using the code below where when a cell is selected then that cells interior color changes from yellow to blue.
When i then slected another cell this previously selected cell then reverts back to yellow.
You will see that column D and H have there own specific color & do not change to blue.
Please can you advise how to edit the code so when the is cell is selected it now turns that row blue as opposed to just that cell.
Still column D and H would have there own specific color
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
Dim LastRow As Long
LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
If Intersect(Target, Range("A8:I" & LastRow)) Is Nothing Then Exit Sub
If Target.Column <> 4 And Target.Column <> 7 Then
Range("A8:C" & LastRow).Interior.ColorIndex = 6
Range("E8:F" & LastRow).Interior.ColorIndex = 6
Range("H8:I" & LastRow).Interior.ColorIndex = 6
Target.Interior.ColorIndex = 8
End Sub