如何整一个上网计时Excel
答案:1 悬赏:50 手机版
解决时间 2021-04-24 22:50
- 提问者网友:我是女神我骄傲
- 2021-04-23 22:40
不会做.有人教下吗?
最佳答案
- 五星知识达人网友:杯酒困英雄
- 2021-04-23 22:48
操作步骤:
1、在Excel工作表里按Alt+F11,打开VBA编程界面
2、在VBA编程界面的工具栏,第二个按钮拉下来选模块
3、在左边栏的你需要计时器的那个工作表名字上双击,打开右边的程序书写区域
4、把下面的程序代码粘贴进去
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Cells.Count = 1 And (Not Intersect(Target.Cells(1), Range("B1")) Is Nothing) Then
[B1] = "开始时间"
[C1] = Format(Now(), "Hh:mm:Ss")
[D1] = Timer
[D1].Font.ColorIndex = 2
[B2:D3].ClearContents
End If
If Target.Cells.Count = 1 And (Not Intersect(Target.Cells(1), Range("B2")) Is Nothing) Then
[B2] = "结束时间"
[C2] = Format(Now(), "Hh:mm:Ss")
[D2] = Timer
[D2].Font.ColorIndex = 2
[B3] = "总共用时"
[C3] = Format([D2] - [D1], "#0.00")
[D3] = "秒"
End If
Target.Offset(1, 0).Select
End Sub
5、关闭VBA编程界面回到工作表
6、双击B1开始计时,双击B2终止计时,用时结果在C3单元格
(特别提醒:要在Exce中通过菜单“工具-宏-安全性”把宏的安全级别设为中或低以允许宏的运行,否则宏不能运行也得不到你要的结果)
1、在Excel工作表里按Alt+F11,打开VBA编程界面
2、在VBA编程界面的工具栏,第二个按钮拉下来选模块
3、在左边栏的你需要计时器的那个工作表名字上双击,打开右边的程序书写区域
4、把下面的程序代码粘贴进去
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Cells.Count = 1 And (Not Intersect(Target.Cells(1), Range("B1")) Is Nothing) Then
[B1] = "开始时间"
[C1] = Format(Now(), "Hh:mm:Ss")
[D1] = Timer
[D1].Font.ColorIndex = 2
[B2:D3].ClearContents
End If
If Target.Cells.Count = 1 And (Not Intersect(Target.Cells(1), Range("B2")) Is Nothing) Then
[B2] = "结束时间"
[C2] = Format(Now(), "Hh:mm:Ss")
[D2] = Timer
[D2].Font.ColorIndex = 2
[B3] = "总共用时"
[C3] = Format([D2] - [D1], "#0.00")
[D3] = "秒"
End If
Target.Offset(1, 0).Select
End Sub
5、关闭VBA编程界面回到工作表
6、双击B1开始计时,双击B2终止计时,用时结果在C3单元格
(特别提醒:要在Exce中通过菜单“工具-宏-安全性”把宏的安全级别设为中或低以允许宏的运行,否则宏不能运行也得不到你要的结果)
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯