time in and out

KoonAik

New Member
Joined
Oct 1, 2006
Messages
6
I'm trying to create an application to indicate booking in and out. i need to have a time that is always running in a cell. then everytime i scan a barcode, it captures the time and puts into the number in a cell and the time that was scan into another. I'm quite new in vba.

Would really appreciate any form of help.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

wongm003

Board Regular
Joined
Aug 8, 2005
Messages
237
You should not need to keep a running time... the operating system is doing that for you. When you scan in a barcode on the event trigger you can check the system clock... When the sub below is run it will show you the current time in military format. Not quite sure exaclty what you are trying to do, but this should help you with the time piece.

Code:
Public Sub test_time()

    MsgBox Format(Now(), "hh:mm")

End Sub
 

Kevlarhead

Board Regular
Joined
May 23, 2006
Messages
176
Sounds similar to something I've done. I created a spreadsheet to record stock movements, which writes date and time to a worksheet like this:

Code:
Sub EasyTime ()

Range("A1")= Date$ ' Today's Date
Range("A2")= Time$ ' Current time

End Sub

Any good to you?
 

KoonAik

New Member
Joined
Oct 1, 2006
Messages
6
Thanks Guys!! I was away for like 4 days. Really thanks alot. both the code was useful, but i also need to display a time that runs. That's why i needed the code.
 

Kevlarhead

Board Regular
Joined
May 23, 2006
Messages
176

ADVERTISEMENT

Keeping a clock running on the spreadsheet isn't too practical, at least as far as I know. My best guess would be to use a function triggered by OnTime or similar to write the current system time to a worksheet cell. It's not something I've done in the past so I can't give any specific guidance.

The book-in time is written to the sheet when you scan the booked item's barcode. Can't you just use the system clock to see what the time is?

If I've misunderstood the problem, please enlighten me... but I'm unsure why the spreadsheet needs a clock.
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hello,

It's not the best idea to run time in a cell. Better would be to use a textbox.

Feel free to send me an email (see email-button below my posts), subject "time running in cell" & "... in textbox", I'll send you an example for both methods. You can check out if you like it and implement into your workbook.

kind regards,
Erik
 

KoonAik

New Member
Joined
Oct 1, 2006
Messages
6

ADVERTISEMENT

Thanks Guys

Thanks alot guys! I think i will forego the running time after all your advice!
Currently, I doing this checking in system for my office. that's why i need the running time. i need to generate a new spreadsheet everyday, with some textbox(code embedded). Is it possible to generate some new spreadsheet without having a new textbox, but still using the same textbox to check in and out.
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
some questions
what do you want to do with this textbox ? what is "to check in and out" ? how do you translate this in Exel-language ?
how is the new spreadsheet generated ?
spreadsheet = sheet in same workbook ? (not new workbook)
probably offline for a day
 

Kevlarhead

Board Regular
Joined
May 23, 2006
Messages
176
This sounds familar... are you working in a warehouse/stock control environment?

I'm guessing you'd like a spreadsheet for booking items in and out of your control. This spreadsheet needs to record the item numbers taken from the barcodes you scan and write them to a spreadsheet along with the date and time you scanned them. The spreadsheet will generate a new sheet for every day, and each day's scan's will be written to it's own sheet.

Am I right?

[edited for missing apostrophes]
 

Kevlarhead

Board Regular
Joined
May 23, 2006
Messages
176
I'll assume my above post was correct. I'm unsure whether a new sheet for each day is the best idea; you could end up with 100+ sheets relatively soon.

Alternately, you could write 'in' items to one sheet, 'out' items to another and use a Vlookup between the two to derive the number and barcodes of all item in your possession. That's my preferred approach anyway. If you need to know what items moved on a particular day, use autofilter.
 

Forum statistics

Threads
1,141,587
Messages
5,707,236
Members
421,498
Latest member
matinebi

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
Top