选中区域的行
Selection.Rows 严格限制在这个 区域内
Selection.Rows.Interior.ColorIndex = 3
取的是选择区域的行
用的是rows(r1.row) 是这些行的行号----rows(行号) 则为全行
因为 Selection.Rows 往往是数组,所以取出来用得用 for each等方法
For Each r1 In Selection.Rows
Rows(r1.Row).Interior.ColorIndex = 38
Next
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
Application.ScreenUpdating = False
Cells.Interior.ColorIndex = -4142
Cells(3, 3).Interior.ColorIndex = 3
Range("c4:d5").Interior.ColorIndex = 5
Rows("6:6").Interior.ColorIndex = 7
'Row("6:6").Interior.ColorIndex = 7
Columns("b:b").Interior.ColorIndex = 8
'Column("b:b").Interior.ColorIndex = 8
For Each r1 In Selection.Rows
Rows(r1.Row).Interior.ColorIndex = 38
Next
For Each c1 In Selection.Columns
Columns(c1.Column).Interior.ColorIndex = 38
Next
Application.ScreenUpdating = True
End Sub