Results 1 to 10 of 29

Thread: Code Required to calculate number of days worked, normal overtime and holiday overtime

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10

    Further to the TWO codes you now have from US .......... :)

    Hi Nelson,
    Quote Originally Posted by nelsondavid View Post
    ..i need normal OT and Holiday OT to appear exactly in cell G34 and J34 ...
    I think you can see what part of the code determines where the output goes
    Code:
    '3f) Paste out final Totals and days to current Worksheet
         Let wsStear.Range("G34").Value = NOHrsV2 * 24 'Normal Overtime is held in Array as fraction of a day
         Let wsStear.Range("J34").Value = HOHrsV2 * 24 'Holiday Overtime is held in Array as fraction of a day
         Let wsStear.Range("C34").Value = TDays ' The constant value of Total days is simply added to cell C34
    '3g) Normal   Hrs  ( Column I ) and Overtime Hrs ( Column J ) are  changed
    Code:
    '3f) Paste out final Totals formulas and days to current Worksheet
         Let wsStear.Range("G35").Value = "=SUMIF(K1:K" & lr & ",""N"",J1:J" & lr & ")*24"
         Let wsStear.Range("J35").Value = "=SUMIF(K1:K" & lr & ",""H"",J1:J" & lr & ")*24"
         Let wsStear.Range("C34").Value = TDays ' The constant value of Total days is simply added to cell C34
    '3g) Normal   Hrs  ( Column I ) and Overtime Hrs ( Column J ) are  changed ' And can paste out help column if you like
    I am sure you can understand how to modify to change which cells are used for where the total appear
    _............................................


    Quote Originally Posted by nelsondavid View Post
    .... Can i use the same code for every month ...
    Yes..
    Quote Originally Posted by nelsondavid View Post
    . if yes what changes i need to do from my end..
    ..The code is not in any way dependant on any month information......There is no reason that I can see to need to change anything..
    Quote Originally Posted by nelsondavid View Post
    ....what changes i need to do from my end..
    You should not need to change your end, leave it alone, at least as far as any effect on the Months are concerned
    _................................................. .......


    Quote Originally Posted by nelsondavid View Post
    ...I have around 800 sheets ...will the code work on all sheets in one go...
    The code is designed to work on multiple worksheets.
    Obviously I only tested it with two.
    If I were you, I would test it first with a larger amount, 10, 30, 60, .100 .......etc.. then finally 800 etc.


    _................................................. ...

    In my opinion, it is very important that you try to understand the code...

    Alan.


    P.s.
    Quote Originally Posted by nelsondavid View Post
    ..The code seems to be working fine..
    We have given you 2 codes
    From Alan
    http://www.excelfox.com/forum/showth...age2#post10066

    From Alan and Admin
    http://www.excelfox.com/forum/showth...age2#post10072
    Last edited by DocAElstein; 02-06-2017 at 03:43 PM.

Similar Threads

  1. Replies: 33
    Last Post: 01-12-2015, 10:08 AM
  2. Replies: 1
    Last Post: 07-23-2013, 10:43 PM
  3. Replies: 0
    Last Post: 09-17-2012, 02:05 PM
  4. The Number of Years, Months and Days Between Two Dates
    By Rick Rothstein in forum Rick Rothstein's Corner
    Replies: 7
    Last Post: 06-08-2012, 10:35 PM
  5. Number of Days In A Month
    By Excel Fox in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 05-14-2011, 08:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •