Getting System Time

Judy

New Member
Joined
Mar 24, 2002
Messages
3
I want to scan the students (they have barcode stickers) in our cross country event when they come back across the line. I want excel to get the barcode and grab the system time and correspond it to the barcode.
I don't want to use a macro as that is a keystroke after the scan. I can do it with a function using NOW() but every time I add another entry it updates all the times, volatile. How can I get to keep the time it first gets instead of updating all the time?
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Please give some more detail as to how this information is being entered.
Which cells?
By way of DDE?
Formulas, as far as I know, cannot be made static.
I could be wrong about that...
A simple event capture would be fast enough.
Perhaps just as fast as a function.
If not as fast the time involved would be miniscule.
Please post more information.
Tom
 
Upvote 0
I scan the barcode at cell A2 and the barcode number goes in there. The B column has the following =IF(A2>0,NOW(),"")copied down to all cells. So when A2 has a value in it B2 gets the time. After the scan for A2, A3 cell is selected and ready for the next scan. Once cell A3 has a value in it B3 gets the time, but it also updates the previous time in A2 which is where the problem lies. Hope I have explained that little better.
 
Upvote 0
place this in your sheet_change event

If Target.Column = 1 Then _
Cells(Target.Row, 2).Value = Now
 
Upvote 0
Actually, disreguard that non-solution and try this:
The other way involves a keystroke

Place a formula in AA1
=A1

Copy down Col AA

When the info is scanned into A1
the calculation will raise an event which will immediately place now in B

Code should look like this

Private Sub Worksheet_Calculate()
If ActiveCell.Column = 1 Then _
Cells(ActiveCell.Row, 2).Value = Now
End Sub

try it out
Works with DDE, queries
I just created a workbook using real time and ran code based upon the calculate event.

Tom


PS

You mentioned that it scrolled down automatically to the next row?

You may need to use this code in place of the other

Try both


Private Sub Worksheet_Calculate()
If ActiveCell.Column = 1 Then _
Cells(ActiveCell.Row - 1, 2).Value = Now
End Sub
This message was edited by TsTom on 2002-03-25 15:26
 
Upvote 0
Thanks for that, I haven't worked with events before, but I will work out what I need to do there and let you know.
thanks
Judy
 
Upvote 0

Forum statistics

Threads
1,213,506
Messages
6,114,024
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top