Highlighting the current row

Last update on October 7, 2009 09:49 AM by jak58
Published by jak58

Highlighting the current row







Issue


When you make conversion on a Excel sheet, you often loses the point of reference.

Solution


This little function highlights any line where the cursor is located.

To put in the module sheet

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static AncAdress As Long
'If the function activation / deactivation is implemented add the line below     

    if ActivationLine  then exit sub

    If Target.Count > 1 Then Exit Sub
    If AncAdress <> 0 Then ' restore to normal
        Rows(AncAdress).Interior.ColorIndex = xlNone
        Rows(AncAdress).Font.ColorIndex = 0
    End If
    Target.EntireRow.Font.ColorIndex = 6
    Target.EntireRow.Interior.ColorIndex = 3
    Target.EntireRow.Interior.Pattern = xlSolid
    AncAdress = Target.Row
End Sub

Adding it to a general module (eg Module1)


If you want to activate / deactivate the function
  • Or put a button on the macro
  • Or put a shortcut



Default highlighting is active, click on the button or shortcut to change

Public ActivationLigne as boolean 
Sub Activate() 
     ActivationLigne = not ActivationLigne 
end sub
Best answers for « Highlighting the current row » in :
Excel tips : How to insert date in a cell ShowExcel tips : How to insert date in a cell Below are some tips on how to insert date and time in an excel cell for a specific purpose:- To insert current date, press CTRL ¯+ ;¯ in the chosen cell. To insert current time, press CTRL¯+...
How to freeze a row in an excel sheet ShowHow to freeze a row in an excel sheet To freeze a line in an excel sheet, for example line 1: Select line 2. Go to menu Window¯ and select Freeze panes¯.
EXCEL: The INTERSECTION function ShowEXCEL: The INTERSECTION function You have a table consisting of rows and columns. Want to know the value of the cell at the intersection of a particular row / column in your table Example: Your table: - starts C3 to F3 ......
Download CurrPorts ShowDeescription CurrPorts is a software that will display all the current ports that are being used and also the programs that are currently using them. Features: If you wish to do so, you can even close a connection of your choice and use the...