a=1: t = time 执行时为何提示“变量未定义”?
Dim t As DateDim a
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
x = Target.Row
y = Target.Column
If (3 < x And x < 9) And (y > 7 And y < 13) Then
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 41
If Target = 1 Then
a = 1: t = time
End If
If Target = 25 And a = 1 Then
b = time - t
s = Second(b)
m = Minute(b)
MsgBox "用时" & m & "分" & s & "秒", , "时间提示"
a = 0
End If
End If
End Sub 加一句,dim t 不报错了,但计时不准。谢谢! ?哪里不准?
页:
[1]