Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2233|回复: 3

a=1: t = time 执行时为何提示“变量未定义”?

[复制链接]
发表于 2014-9-21 21:42 | 显示全部楼层 |阅读模式
Dim t As Date
Dim 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
excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2014-9-21 21:52 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2014-9-21 22:00 | 显示全部楼层
回复

使用道具 举报

发表于 2014-9-21 22:33 | 显示全部楼层
?哪里不准?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-4-20 08:41 , Processed in 0.234702 second(s), 7 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表