Hi,
Is there a counter or clock function in excel?
I want to count time in a cell when another cell gets a certain value...is that possible?
Your help is much appretiaced, thanks!
,KiBBo
Hi,
Is there a counter or clock function in excel?
I want to count time in a cell when another cell gets a certain value...is that possible?
Your help is much appretiaced, thanks!
,KiBBo
put this code into the Worksheets VBE object. Change A1 witht he cell that you want to verify and the offset should reference the cell that you want the time input to. Also, change the IF condition of Target = 5 to whatever condition you are checking for.
Please Login or Register to view this content.
---------------------------------------------------
ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
To insert code into the VBE (Visual Basic Editor)
- Copy the code.
- Open workbook to paste code into.
- Right click any worksheet tab, select View Code
- VBE (Visual Basic Editor) opens to that sheets object
- You may change to another sheets object or the This Workbook object by double clicking it in the Project window
- In the blank space below the word "General" paste the copied code.
Thanks for you reply Excelenator!
I think I explained myself badly...I really need a "timer" or calculator which counts seconds when I trigger it with certain value in certain cell. With "Now" function the value (actual time) is always refreshed and I don't now anymore when count started....any other suggestions or advices how I can use that "Now"- function?
In the code module for the sheet:In a normal module:Please Login or Register to view this content.
put =timeInterval() in a cell and it will start counting as soon as the contents of A1 are 2 or greater. That cell will refresh its value whenever you change the selection. Setting A1 to 0 will reinitialize the timer.Please Login or Register to view this content.
The cell location and trigger values to match your needs would go in the Worksheet_Change routine.
Edit: Change in routine to prevent crashing when text is in A1.
Last edited by mikerickson; 11-12-2007 at 03:59 PM.
You can use ontime.
Place this code in a module:
Put this under the sheet module:Please Login or Register to view this content.
And this in the thisworkbook module:Please Login or Register to view this content.
When ever the value in cell a1 gets above 1 the timer will start in B1. It will only stop and reset when the cell goes below 1.Please Login or Register to view this content.
You could also use a start/stop button if you like.
Format cell B1 as custom format "hh:mm:ss"
See attached for further help.
Last edited by Reafidy; 11-12-2007 at 05:19 PM.
Reafidy.
Tip: When using code and disabling events/screen updates/calculation be sure to use an error handler to turn them back on if an error occurs.
...solved with your help, thanks to everybody!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks