office交流網(wǎng)--QQ交流群號及微信交流群

Access培訓(xùn)群:792054000         Excel免費(fèi)交流群群:686050929          Outlook交流群:221378704    

Word交流群:218156588             PPT交流群:324131555

微信交流群(請用微信掃碼)

        

Excel點(diǎn)擊選中的行改變顏色

2019-11-18 13:45:00
tmtony8
原創(chuàng)
6841

在Excel表格中,我們?yōu)榱?strong>突出顯示選中的記錄。有時希望高亮顯示點(diǎn)擊的行。

在當(dāng)前工作表的Worksheet_SelectionChange事件添加下面的代碼,可在鼠標(biāo)點(diǎn)擊后高亮顯示該行數(shù)據(jù)。

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    On Error Resume Next
    
    Cells.FormatConditions.Delete
    
    With Target.EntireRow.FormatConditions
        
        .Delete
        
        .Add xlExpression, , "TRUE"
        
        .Item(1).Interior.ColorIndex = 6
        
    End With
End Sub



附上顏色代碼編號。

    分享
    文章分類
    聯(lián)系我們
    聯(lián)系人: 王先生
    Email: 18449932@qq.com
    QQ: 18449932
    微博: officecn01
    移動訪問