how to write a macro?

D

Damian.Nita

Hi guys/girls,

I have the worst time trying to figure out how to write a macro for an
schedule i need for my work.What i need is a macro that can figure out
that if Joh starts his work at anytime before 4PM copy his work hrs to
a sheet i made (a bar graph) on to the right column.And if he starts
after 4 put him on the left column.My bar graph is divided in 9 rows
but the one to the left is for day shift and the one to the right is
for night shift.I'd really apreciate any help with this.

Thank you,
Damian
 
R

Ron de Bruin

Hi Damian

24 hours is between 0 and 1

0:00 Am = 0
3:00 Am = 0.125
12:00 PM = 0.5
6:00 PM = 0.75
.....
....
...

with the time in E1 you can do this to test
If Range("E1").Value > 0.625 Then MsgBox "Later then 15 PM"
 
D

Damian.Nita

I'm not sure that's what i need.
I'll explain again:
A B C
Name |IN| |OUT|
John 7:00 AM 4:00PM
Jill 4:00 PM 9:30PM


Now my bar graph is divided in 3 sections

Name In Out Hrs 7 8 9 .............10 11 12 Hrs In Out Name
John 7 4 9 x x x .....
........x x 8:30 4 9:30 Jill


Now how do i make excel take the name of the person with the in and
outs and put them in the right columns in my bar graph sheet.The left
column is day shift and the night coulumn is night shift.I can do this
by spliting the schedule in 3 parts but it will take longer to make the
schedule.I want to create a macro that "knows" that if he works at 7
then he is day shift and if she works at 2 or after she is night shift.

Thanks,

Damian
 
Top