HollyAnn73
New Member
- Joined
- Jul 21, 2008
- Messages
- 13
Is there a function that will allow for the active cell's row and column to be highlighted at the same time (while working)?
Dim r As Long, c As Long
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If r > 0 Then
Rows(r).Interior.ColorIndex = xlNone
Columns(c).Interior.ColorIndex = xlNone
End If
r = Target.Row
c = Target.Column
Rows(r).Interior.ColorIndex = 8
Columns(c).Interior.ColorIndex = 8
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static lPrevRow As Long
Static lPrevCol As Long
Static oPrevSelection As Range
On Error Resume Next
oPrevSelection.EntireRow.Interior.ColorIndex = xlNone 'no fill
oPrevSelection.EntireColumn.Interior.ColorIndex = xlNone
Target.EntireRow.Interior.ColorIndex = 4 'green
Target.EntireColumn.Interior.ColorIndex = 4
Set oPrevSelection = Target
End Sub
=OR(CELL("row")=ROW(),CELL("col")=COLUMN())
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = True
End Sub
Salam
you can do it by Conditional Formating
1) select the table
2) form Tab Home -> Conditional Formating -> New Rule , use this formula
3)choose Your Formatting .Code:=OR(CELL("row")=ROW(),CELL("col")=COLUMN())
4) Right Click Sheet Name --> View Code , and put this code
HTHCode:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.ScreenUpdating = True End Sub
Salam
you can do it by Conditional Formating
1) select the table
2) form Tab Home -> Conditional Formating -> New Rule , use this formula
3)choose Your Formatting .Code:=OR(CELL("row")=ROW(),CELL("col")=COLUMN())
4) Right Click Sheet Name --> View Code , and put this code
Code:Private Sub Worksheet_SelectionChange(ByVal Target As Range) Application.ScreenUpdating = True End Sub
HTH