Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
jts jts is offline
external usenet poster
 
Posts: 3
Default code to caputre time in vb in a specific cell

I am starting to use macros in Excel and need help trying to find the visual
basic code (also new at vb) to capure time. I need to start time and finish
time when wroking in Excel to time I sepend completing one form.
JTS
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default code to caputre time in vb in a specific cell

You will need some sort of event to capture the start time and ending time.
I chose the Workbook Open event to capture the start time and BeforeSave
event to capture the ending time. Place this code below in the ThisWorkbook
Module. When you save the workbook a message box will appear telling you the
time it took to fill the form out.

Option Explicit

Dim StartTime As Date
Dim EndTime As Date

Private Sub Workbook_Open()

StartTime = Format(Now, "hh:mm:ss")

End Sub

Private Sub Workbook_BeforeSave()

EndTime = Format(Now, "hh:mm:ss")
MsgBox "Time Elasped = " & Format(EndTime - StartTime, "hh:mm:ss")

End Sub

Hope this helps! If so please click Yes below.
--
Cheers,
Ryan


"JTS" wrote:

I am starting to use macros in Excel and need help trying to find the visual
basic code (also new at vb) to capure time. I need to start time and finish
time when wroking in Excel to time I sepend completing one form.
JTS

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options Yuvraj Excel Discussion (Misc queries) 0 June 29th 09 11:20 AM
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Yuvraj Excel Discussion (Misc queries) 0 June 26th 09 06:01 PM
Code for opening a workbook at a specific time!?! mike_vr Excel Discussion (Misc queries) 2 June 5th 07 04:55 PM
UDF code to find specific text in cell comments, then average cell values bruch04 Excel Programming 3 December 5th 05 10:01 PM
capturing a cell value at a specific time of day Thomas Donino Excel Programming 1 January 13th 04 01:45 PM


All times are GMT +1. The time now is 02:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"