开发者

Excel - Highlight active row

开发者 https://www.devze.com 2022-12-13 09:54 出处:网络
Wondering if there is some preference I can set in excel so that when I am in a specific cell the entire row is slightly highlighted (not overl开发者_运维技巧y so but enough to easily tell it out)

Wondering if there is some preference I can set in excel so that when I am in a specific cell the entire row is slightly highlighted (not overl开发者_运维技巧y so but enough to easily tell it out)

Similar to the fashion that Notepad++ works in tab delimeted files, and highlights the entire row.

Thanks in advance


I do not know of any built-in preferences in Excel to do this but it can be done using VBA. Place the following in "ThisWorkbook" of the VBAProject:

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Tgt As Range)
    If Tgt.Cells.Count = 1 Then
        ActiveSheet.Rows(Tgt.Row).Select
        Tgt.Activate
    End If
End Sub

The code only highlights the active row if a single cell is selected so that it does not interfere when multiple cells are selected.

0

精彩评论

暂无评论...
验证码 换一张
取 消