ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
I use the following code to high light rows & active cells etc.
My range is A-G & currently row`s 3-28
How can this code be altered so if the row 29 or 30 is selected then the Interior cell color & active cell turn Red
My range is A-G & currently row`s 3-28
How can this code be altered so if the row 29 or 30 is selected then the Interior cell color & active cell turn Red
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myStartCol As String
Dim myEndCol As String
Dim myStartRow As Long
Dim myLastRow As Long
Dim myRange As Range
If Target.Cells.Count > 1 Then Exit Sub
Application.ScreenUpdating = False
myStartCol = "A"
myEndCol = "G"
myStartRow = 3
myLastRow = 28
Set myRange = Range(Cells(myStartRow, myStartCol), Cells(myLastRow, myEndCol))
myRange.Interior.ColorIndex = 2
If Intersect(Target, myRange) Is Nothing Then Exit Sub
Range(Cells(Target.Row, myStartCol), Cells(Target.Row, myEndCol)).Interior.ColorIndex = 6
Target.Interior.Color = vbGreen
Application.ScreenUpdating = True
End Sub