Results 1 to 5 of 5

Adapt VBA script to add criteria to randomize filter

Threaded View

  1. #1
    Registered User
    Join Date
    07-01-2015
    Location
    Antwerp
    MS-Off Ver
    2019
    Posts
    72

    Adapt VBA script to add criteria to randomize filter

    Hi,

    Attached, you can find a workbook that contains a button on the first tab. The button generates monthly sheet tables containing names of people (short names or "shorts") that are randomly filtered from a main table.

    Do you know how to adapt the VBA code in order to include the criteria below in the combined rows 4, 5 and 6 of each generated month sheet?

    • Row 4: Shorts with two criteria "Full revision" and "Overwork" that are filtered from the table on the main table sheet. Per day, this short in row 4 has to be different from the shorts in rows 5 and 6. A short of row 4 can only be used once a week and maximum twice a month. Preferably, the line of VBA code defining the monthly maximum is customisable (i.e. easily editable to e.g. once a month).

    • Rows 5 and 6: Shorts with two criteria "Translation" and "Overwork".

    • Combined rows 4, 5 and 6: Per day, the shorts in rows 4, 5 and 6 have to be unique. For the combined rows 4, 5 and 6, there also cannot be similar shorts on an adjacent day in the same working week.
      Example: a short of row 5 on Monday cannot be the same short of row 4 on Tuesday, but it could be the same short as row 6 on Friday of the previous week.

    • Shorts of rows 4, 5 and 6 can be used maximum 4 times a month if the short works 76-100%, 3 times a month if 51-75%, and 2 times a month if 0-50% (for the exact percentages, see "full/part time" column of the table in the main table sheet). If a month has not been completely filled out in the rows 4, 5 or 6, all shorts must be maximized. Example: a 100% short cannot be only filled in 3 times a month, it should be filled in 4 times a month. This also means that no short can work less than twice a month, nor more than four times a month.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. excel filter function: trying to adapt and getting error
    By masterx7 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-23-2020, 09:46 PM
  2. [SOLVED] Need to Adapt VBA Script for my file
    By MermaidNiki in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-20-2017, 07:23 PM
  3. Code to randomize within a filter
    By ScottBeatty in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-30-2013, 04:32 PM
  4. Excel 2007 : Need to sort & randomize by certain criteria
    By Snowberri24 in forum Excel General
    Replies: 0
    Last Post: 12-15-2010, 06:37 PM
  5. Advanced Filter VB Script for Variable Criteria Range
    By Jason in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2006, 02:15 AM
  6. Adapt code to show filter
    By Jack in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-19-2006, 07:25 AM
  7. Replies: 1
    Last Post: 02-24-2005, 06:26 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