excel中单击单元格行、列变色
1、先右键我们的工作表,点击查看代码

3、单击后所属行变色Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)On Error Resume NextCells.FormatConditions.DeleteWith Target.EntireRow.FormatConditions.Delete.Add xlExpression, , "TRUE".Item(1).Interior.ColorIndex = 7End WithEnd Sub
4、单击后行、列均变色Private Sub Worksheet_SelectionChange(ByVal Target As R锾攒揉敫ange) Cells.Interior.ColorIndex = xlNone Target.EntireRow.Interior.ColorIndex = 8 Target.EntireColumn.Interior.ColorIndex = 8End Sub
5、右键打开后,直接复制进去代码,直接关闭

7、最后,我们就会发现,任意点击单元格就能将整行变色。录入不同的代码将进行不同的行、列变色
