工作表的代码 Private
Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Count = 1 Then If Target.Address = "$G$2" Then If MsgBox("是否重置数据?", vbYesNo) = vbYes Then Dim MyCell As Range Application.ScreenUpdating = False For
Each MyCell In UsedRange If MyCell.Interior.ColorIndex = 36 Then MyCell = "" Next Application.ScreenUpdating = True Exit
Sub End
If End
If If Target.Address = "$F$2" Then If
Not PreCell Is
Nothing
Then If MsgBox("恢复点击前数据吗?", vbYesNo) = vbYes Then  reCell = PreCell - 1 Exit
Sub End
If End
If End
If If Target.Interior.ColorIndex = 36 Then Target = Target + 1 Set PreCell = Target End
If End
If End
Sub
添加一个模块,代码: Public PreCell As Range |