VBA time

M

Marco

I am working on timesheet application which uses excel. I am having a
problem with the way excel handles time. Employees can select their
names, the date, and time-in/out from a pull down menu. The program
identifies a sheet with the employee's name and a column with the date
and has to scroll down to the row matching the time/in or out. This
way, I can have the macro write 'In' or 'Out' at a time corresponding
with the employee's time_in or out. The main problem I am having is
with how to sum the employee's hours for a day, or a week. What I
essentially have right now is a sheet which says 'in' next to 8 am and
out, for example, by 12 p.m. Additionally, I would like to mark the
hours the employees worked with a certain type of activity, depending
on the project they worked. My basic question is what is the best way
to compute hours in excel. As most of you know, excel automatically
assigns fractions to time values. I am pretty green at this and would
appreciate any insights.
 
G

Graham Mayor

A good start would be to ask your Excel questions in an Excel forum. This
one is for Word VBA!
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Karl E. Peterson

Marco said:
My basic question is what is the best way to compute hours in excel.
As most of you know, excel automatically assigns fractions to time values.

Those are fractions of a day, thus making date/time math exceedingly simple! Just
add 'em up, and multiply by 24, to get hours. IOW, to get a duration, you could do
this:

Hours = (EndTime - StartTime) * 24

Slight variation:

Minutes = (EndTime - StartTime) * (24 * 60)

See how it works? Now, for more detailed *Excel* help, I agree with the other
poster -- there are more appropriate groups.
 
M

Marco

I am working on timesheet application which uses excel. I am having a
problem with the way excel handles time. Employees can select their
names, the date, and time-in/out from a pull down menu. The program
identifies a sheet with the employee's name and a column with the date
and has to scroll down to the row matching the time/in or out. This
way, I can have the macro write 'In' or 'Out' at a time corresponding
with the employee's time_in or out. The main problem I am having is
with how to sum the employee's hours for a day, or a week. What I
essentially have right now is a sheet which says 'in' next to 8 am and
out, for example, by 12 p.m. Additionally, I would like to mark the
hours the employees worked with a certain type of activity, depending
on the project they worked. My basic question is what is the best way
to compute hours in excel. As most of you know, excel automatically
assigns fractions to time values. I am pretty green at this and would
appreciate any insights.

Thank you, Karl!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top