+ Reply to Thread
Results 1 to 5 of 5

VBA Function Dateadd not working with "w" weekday arithmetic?

  1. #1
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    590

    VBA Function Dateadd not working with "w" weekday arithmetic?

    Office 365...

    Seems I am getting the exact same results when I run:

    DateAdd("w",7,DATE)

    or

    DateAdd("d",7,DATE)

    in that the identifier for a weekday, "w", is not skipping weekends.

    As I didn't see anyone else having this problem, either I am doing something wrong or no one else cares!

    Can anyone either suggest how I might be causing the problem or suggest a nice fix?

    Thank-you!

  2. #2
    Registered User
    Join Date
    12-13-2016
    Location
    Ottawa
    MS-Off Ver
    Office 2010
    Posts
    4

    Re: VBA Function Dateadd not working with "w" weekday arithmetic?

    Hi

    If you trying to get a date 7 working days later, you can try the workday function

    =WORKDAY (start_date, days, [holidays])

    Hope this helps

  3. #3
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    590

    Re: VBA Function Dateadd not working with "w" weekday arithmetic?

    Thank-you!

    Yes, I was hoping that I just was doing something stupid, but it looks like I will need to call in Application.WorksheetFunction and run it that way if I can't find fault in what I'm doing!

  4. #4
    Forum Contributor
    Join Date
    07-23-2016
    Location
    Texas
    MS-Off Ver
    2016
    Posts
    273

    Re: VBA Function Dateadd not working with "w" weekday arithmetic?

    It's up to you but don't see the problem using the following to add 7 workdays to the current date (leave out the cvDate if you only need the dateserial number:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-05-2007
    Location
    Falmouth, VA now, Palm Bay, FL for 2 yrs, was Colorado Springs, CO for ten years; Cedark Park, TX; Zeeland, MI; Wilmette, IL; Princeton Junction, NJ; NY, NY
    MS-Off Ver
    365
    Posts
    590

    Re: VBA Function Dateadd not working with "w" weekday arithmetic?

    Yup, I am running the same for now. I was hoping there was a problem in my methodology or a setting as I have to believe that the native VBA functions run more efficiently (most of the time...) than application,worksheetfunction calls. Will have to post somewhere to let them know they have something more to fix besides the latest preview of W10, which crashes every time I tried to use my mouse...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] "Replace:=False" Not Working with .Select Function
    By mgaworecki in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-02-2016, 10:04 AM
  2. Replies: 8
    Last Post: 06-21-2016, 08:56 AM
  3. VLOOKUP not working for sheet 1 called "2016" in "Jobs.xlsx"
    By A2G in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 01-19-2016, 11:53 AM
  4. [SOLVED] Counif function not working properly! Returning "0".
    By Phily915 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-12-2014, 05:22 AM
  5. My user created "Is_Integer" function not working correctly.
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 30
    Last Post: 02-21-2013, 07:39 PM
  6. Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" not working
    By redders in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2011, 03:52 PM
  7. Weekday() Function Error "791"
    By jadnat2k in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-14-2008, 01:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1