+ Reply to Thread
Results 1 to 4 of 4

VBA to Calculate Start Date from End Date and Dev Time Using WORKDAY()

  1. #1
    Registered User
    Join Date
    07-15-2013
    Location
    Arizona
    MS-Off Ver
    Excel 2016
    Posts
    64

    VBA to Calculate Start Date from End Date and Dev Time Using WORKDAY()

    Hi Forum and thanks in advance!

    I'm working on a planning tool and would like to provide the user a "recommended latest start date" for a project tactic using the WORKDAY function. I need them to be able to reference it after entering their development time and desired target completion date in another column for the tactic in that row. I'd like to show this latest start date in a shape (I've named it LatestStartDateProject) on the worksheet and have it change when they move to different active rows.

    Here's my failed attempt so far:

    Please Login or Register  to view this content.

    I have this code sitting in the ProjectTacticalPlan worksheet module. The WorkDay function approach I've used above basically attempts to reverse the logic of the function to count backwards (it works well as a formula in the cell, but in short I cannot use that in this case as it's not compatible with the user experience). I've reviewed many threads but can't get no action on the formulas I've tried!

    Any help is much appreciated! Please let me know if you have questions.

    Thanks,
    Chris

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA to Calculate Start Date from End Date and Dev Time Using WORKDAY()

    Hi Chris,

    Your function can't work because the answer to a function is always the function name:

    Please Login or Register  to view this content.
    But your code should work as a subroutine:

    Please Login or Register  to view this content.
    BTW - I don't see where you use the variable Holidays
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    07-15-2013
    Location
    Arizona
    MS-Off Ver
    Excel 2016
    Posts
    64

    Re: VBA to Calculate Start Date from End Date and Dev Time Using WORKDAY()

    Thanks for the quick response XLAdept! Sorry I'm just now getting back to this, can't believe it's been this long already!

    Good news is that I was able to take your code (and education) and get it to work with my selection change routine I had set up with other functionality on this sheet. I just added a little error handling (which I'm sure could be done more elegantly) based on how it was functioning. Really appreciate your help as this gets me closer to "done" with this crazy thing.

    I wasn't sure what you meant by my not using the variable "Holidays"...that is a named range on another sheet ("HolidayList") I'm using to exclude holidays in my calculation of work days between the StartDate and EndDate. Maybe the validity of your question is why the code you've provided didn't pick up that named range in the calculation of StartDate. I had to actually list the range specifically as B1:B28 to get it to work and see those holidays. If you have any suggestions there, I'd appreciate your thoughts on how to make the named range work instead.

    Please Login or Register  to view this content.
    Otherwise, thanks again!

    In gratitude,
    Chris

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: VBA to Calculate Start Date from End Date and Dev Time Using WORKDAY()

    Hi Chris,

    You're welcome and thanks for the rep!

    Please Login or Register  to view this content.
    what I meant is that you're not using that variable anywhere.

+ 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. Replies: 10
    Last Post: 02-29-2024, 08:55 AM
  2. Replies: 3
    Last Post: 12-19-2013, 06:49 AM
  3. [SOLVED] Calculate number of hours from Start date and time and End date and time
    By sathyasun in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-28-2013, 01:04 AM
  4. [SOLVED] workday function --> calculate START date
    By kaaver in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-11-2010, 11:31 AM
  5. Calculate PTO Time by Start Date
    By concretetsunami in forum Excel General
    Replies: 1
    Last Post: 01-18-2010, 05:51 PM

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