+ Reply to Thread
Results 1 to 4 of 4

[SOLVED] Generate Dates Excluding Weekends

  1. #1
    Registered User
    Join Date
    10-01-2007
    Posts
    49

    [SOLVED] Generate Dates Excluding Weekends

    I've made a script that will auto-fill a list of dates between a user-specified range of dates, randomly mix them up using the sort function, skims off a user-specified sample of those dates from the top of the sorted list, and then copy/paste them onto Sheet1 in order based on time.

    I previously had the script set up only for dates from 1/1/2010 - 12/31/2010, giving the user no option to specify dates. I then copied/pasted the same dates without weekends so as to give the user an option of running the script to exclude weekend dates. I soon learned that excluding weekends was much more difficult when the dates are generated as opposed to manually added. In a perfect world, I would have one macro that would have a checkbox for Exclude Weekends? but I'm not opposed to having two different macros and two different run buttons. I've been working on this all afternoon and would very much appreciate any help I could get. I've attached the file.

    Any coding suggestions are also very much appreciated, as I'm very new to VBA and I've already implemented many suggestions.
    Attached Files Attached Files
    Last edited by chbrandt; 08-08-2010 at 11:55 PM. Reason: Solved

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,229

    Re: Autofill Dates Excluding Weekends

    Is this what you are trying to do using VBA?
    See this link.

  3. #3
    Registered User
    Join Date
    10-01-2007
    Posts
    49

    Re: Autofill Dates Excluding Weekends

    Yes, I would like to do this using VBA, except the dates wouldn't exactly be autofilled I guess, they would be generated by the script based on a user-specified date range.

  4. #4
    Registered User
    Join Date
    10-01-2007
    Posts
    49

    Re: Generate Dates Excluding Weekends

    After much searching, I found a thread from 3+ years ago in another forum where Six Strings had the needed piece to my puzzle: the NETWORKDAYS function. It seems to be working for me right now, but I know it could be done much better, so I would still appreciate any critical criticism.

    Please see attached.

    Chris
    Attached Files Attached Files

+ 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