View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default Calculating the difference between hours

If the problem is now that the code runs but the result is wrong, I think this
is the problem:

In your first message on Oct 3, you said "The work hours from 5 AM to 6 PM".
(At least I think it's your first message.)

Based on that statement, I assumed that was ALWAYS true, and wrote the code
with that assumption.

Now you talk about DayStart = 07:30 and DayEnd = 15:30. Are these the correct
times, and are those correct for every case? Or are they completely variable?
Which ever it is, the macro must be modified.

If the workday start and end times are always the same, the constants in the
code must be changed.

If these times are variable, the macro has to be changed to include two more
arguments so you can tell it what those times are.

Please advise.

In the meantime, I'll post code that *requires* that you specify the day start
and day end times.

PS: When writing macros, you can't change the conditions, or assumptions about
conditions (e.g. the times the workday starts and ends), in mid-stream, so to
speak, and expect the code to work.


The startDate: 10/6/2004 12:53:26 PM
the EndDate : 10/6/2004 1:45:46 PM

Daystart : 7:30
DayEnd: 15:30