Finding Difference Between Two Times

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
524
Office Version
2011
Platform
MacOS
Hello,

I have been trying without any luck to find the time difference (Sun - Sat, employee start & finish times) between two columns of times, but the finish time may go into the next day. I found a post here that I thought might work, but VBA MOD is apparently different from Excel MOD.

I merely have columns starting as "SUN Start Time", "SUN Finish Time", "MON Start Time", "MON Finish Time", and so on until "SAT Finish Time" and need to find the time difference between each days start and finish in order to combine them and find the total hours worked in a week.

If needed, the columns go from "AO" (col # 41) to "BB" (col # 54)

Thanks to whomever jumps in on this to help!
 

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
524
Office Version
2011
Platform
MacOS
This is what I needed to do once the numerical value of the difference in hours per day was calculated:

Code:
   'Budget is pre-set in another column
   'PayRate is pre-set in another column
   'MPay = Monthly Pay
   'MPayout = string of the monthly pay so I can set the format
   'of the string to show in the label on the PayrollInformationForm

   HrsWorked = Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday
   MPay = (HrsWorked * PayRate) * 4.3
   MPayout = CStr(MPay)
   
   If MPay > MBudget Then PayrollInformationForm.MonthlyPay.ForeColor = vbRed
    
   MPayout = Format(MPayout, "$###,###.00")
   PayrollInformationForm.MonthlyPay = MPayout
 

Forum statistics

Threads
1,081,657
Messages
5,360,291
Members
400,580
Latest member
Drexl88

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top