太复杂了 没有细看 ,但以下代码也能实现 颜色改变事件 Private Sub CommandButton1_Click() Dim s As String, s1 As String Dim RG As Range, Tr As Boolean If CommandButton1.Caption <> "停止" Then CommandButton1.Caption = "停止" Else CommandButton1.Caption = "开始" End If Do While CommandButton1.Caption = "停止" a = ActiveCell.Interior.ColorIndex s = ActiveCell.Address Set RG = ActiveCell Do While a = RG.Interior.ColorIndex DoEvents s1 = ActiveCell.Address If s1 <> s Or CommandButton1.Caption = "开始" Then Tr = True Exit Do End If Loop If Tr = False Then MsgBox s & "变色了" Tr = False s = ActiveCell.Address Loop End Sub
[此贴子已经被作者于2007-10-21 1:06:05编辑过] |