dcsimg
Results 1 to 5 of 5

Thread: Roll network days

  1. #1

    Thread Starter
    Member
    Join Date
    May 2019
    Posts
    58

    Roll network days

    Hi,

    I wish to run a macro that will roll forward yesterdays workday into today's current work day, whilst also taking into account the bank holidays on the right.

    The cell reference I need updating is I8.

    The cell formula in I7 is =NETWORKDAYS(I2,I4,$K$3:$K$10)

    I'm really green at VBA so any help would be greatly appreciated.

    Name:  Capture 1.JPG
Views: 67
Size:  29.5 KB

    Thank you.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,450

    Re: Roll network days

    wouldn't that be formula
    = i7 + 1
    nothing to do with vba
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    Member
    Join Date
    May 2019
    Posts
    58

    Re: Roll network days

    Yep of course that would work.

    But I want to take into account the weekend and bank holidays. Hence the workdays reference and I don't want it to update as soon as I open the spreadsheet. I have few macro's that need to be actioned first before I roll the date.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    24,450

    Re: Roll network days

    assuming the workbook macros only run on workdays then at the end of the macros to run first
    Code:
    range("i8") = range("i7") + 1
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    Member
    Join Date
    May 2019
    Posts
    58

    Re: Roll network days

    Thanks dude. I will test this over next 5 days and see if it works.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width