+ Reply to Thread
Results 1 to 5 of 5

Subtraction using WorksheetFunction.WorkDay results in mismatch

  1. #1
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Subtraction using WorksheetFunction.WorkDay results in mismatch

    Hello anybody,

    following piece of code results in "Type mismatch" error:

    Please Login or Register  to view this content.
    The cells in range contain dates, I know that WorksheetFunction.WorkDay returns "double"... I tried some conversions (cell.Value to double, WorksheetFunction.WorkDay to date), but no success.

    Thanks for any help.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Subtraction using WorksheetFunction.WorkDay results in mismatch

    can you attach, its a little unclear

  3. #3
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Re: Subtraction using WorksheetFunction.WorkDay results in mismatch

    Hello,

    lots of code inside the workbook, which I'm not allowed to send... but simpler version of my question:

    In this simpler version of my code I'm testing cells (in some range) containing dates, whether the cell date is before the next workday.

    Please Login or Register  to view this content.

    This subtraction results in type mismatch...

  4. #4
    Registered User
    Join Date
    05-07-2013
    Location
    CZ, EU
    MS-Off Ver
    2010/2016
    Posts
    31

    Re: Subtraction using WorksheetFunction.WorkDay results in mismatch

    Problem is in the "0" - there were also some variables and calculation before on the right side, so now I can change it to

    If WorksheetFunction.WorkDay(Date, 1) > cell.Value Then

    ...

  5. #5
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Subtraction using WorksheetFunction.WorkDay results in mismatch

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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