Private Sub Worksheet_SelectionChange(ByVal Target As Range) '选区改变时
If Selection.Rows.Count = 1 And Selection.Columns.Count = 256 And Cells(ActiveCell.Row, 1) = 1 Then '选中整行,并且该行第一列值为 1
Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 256)).Interior.Color = RGB(0, 255, 0) '整行单元格颜色为绿色(RGB 0,255,0)
End If
End Sub
温馨提示:答案为网友推荐,仅供参考