vijay.vizzu
Member
Dear All,
I have an below code to highlight the current position of the cell for better visualization. But when i run this code, it will erase all the current formating. So i want to put two buttons (start and stop)to run the code, If i click start, it need to be highlighted the current cell position, if i click stop it has to be stopped and return back to my current formatting. Kindly modify the code as per my requirement.
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim RngRow As Range
Dim RngCol As Range
Dim RngFinal As Range
Dim Row As Long
Dim Col As Long
Cells.Interior.ColorIndex = xlNone
Row = Target.Row
Col = Target.Column
Set RngRow = Range("A" & Row, Target)
Set RngCol = Range(Cells(1, Col), Target)
Set RngFinal = Union(RngRow, RngCol)
RngFinal.Interior.ColorIndex = 36
End Sub
Thanks in advance
Vijay
I have an below code to highlight the current position of the cell for better visualization. But when i run this code, it will erase all the current formating. So i want to put two buttons (start and stop)to run the code, If i click start, it need to be highlighted the current cell position, if i click stop it has to be stopped and return back to my current formatting. Kindly modify the code as per my requirement.
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim RngRow As Range
Dim RngCol As Range
Dim RngFinal As Range
Dim Row As Long
Dim Col As Long
Cells.Interior.ColorIndex = xlNone
Row = Target.Row
Col = Target.Column
Set RngRow = Range("A" & Row, Target)
Set RngCol = Range(Cells(1, Col), Target)
Set RngFinal = Union(RngRow, RngCol)
RngFinal.Interior.ColorIndex = 36
End Sub
Thanks in advance
Vijay