'Thisworkbook中的代码:
Public EnableSelectionChange As Boolean
Private Sub Workbook_Open()
EnableSelectionChange = False
End Sub
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If EnableSelectionChange Then
Cells.Interior.Pattern = xlSolid
Cells.Interior.PatternColorIndex = xlAutomatic
Target.EntireColumn.Interior.Pattern = xlChecker
Target.EntireColumn.Interior.PatternColor = 49407
Target.EntireRow.Interior.Pattern = xlChecker
Target.EntireRow.Interior.PatternColor = 49407
End If
End Sub
'模块中的代码:
Sub 阅读模式()
ThisWorkbook.EnableSelectionChange = Not ThisWorkbook.EnableSelectionChange
If ThisWorkbook.EnableSelectionChange Then
Else
End If
End Sub