+ Reply to Thread
Results 1 to 9 of 9

Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

  1. #1
    Registered User
    Join Date
    05-13-2019
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    9

    Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    Greetings,

    I have been trying to crack this for the last few days. So I have days of the month that need to be filled with specific number of people (say 3). Lets say their names are Bob, Tim, Jack. Out of the 30 days of the month, I need Bob to fill 50%, Tim to fill 30%, and Jack to take the remaining 20%. What I am trying to do is to fill these names in randomly throughout the month with the above specific percentages. These percentages will change each month and I was looking for a way to this via a formula where I can enter the percentages and the cells where their names will be listed with fill automatically. Thanks for your help.

    I have attached a sample spreadsheet of what I am trying to accomplish.

    V/R

    Dom
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,715

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    hi
    one of the forum gurus can probably do this more elegantly, but this macro seems to work.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-13-2019
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    9

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    Awesome. Will take a look. Is there anyway to do this with a formula that doesn’t use the rand/randbetween or other volatile functions?

  4. #4
    Registered User
    Join Date
    05-13-2019
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    9

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    Tried the VBA above and I received a “Run time Error 91- object variable not set” error message

  5. #5
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,715

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    oh dear - do you know which line is causing the error?

  6. #6
    Registered User
    Join Date
    05-13-2019
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    9

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    For each cc in DestRange.Cells

  7. #7
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,715

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    hmm that should not be problematic =
    can you try inserting

    Please Login or Register  to view this content.
    after

    Please Login or Register  to view this content.
    to see if it is recognising the range - it should return b6:b35

  8. #8
    Registered User
    Join Date
    05-13-2019
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    9

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    Got it working. I missed a line in the code. It works but only fills up the names up to the 15th of the month(b20)

  9. #9
    Registered User
    Join Date
    05-13-2019
    Location
    Japan
    MS-Off Ver
    2010
    Posts
    9

    Re: Fill Specific Range of Cells with 3 Values Randomly to 3 Percentages

    Fixed, had to adjust the NumRange. This works perfectly. Thank you Nicky!

+ 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. Randomly fill the empty cells
    By Berktan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-31-2017, 07:15 AM
  2. How to fill values between two specific cells?
    By media-tel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-16-2014, 11:55 PM
  3. Create Worksheets and fill specific cells with values
    By corneliusj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-23-2014, 09:58 AM
  4. Trying to randomly fill cells with data from a a list.
    By robertmwaring in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-23-2014, 05:11 PM
  5. Replies: 4
    Last Post: 11-18-2011, 05:22 PM
  6. Fill cells randomly constraining/restricting row and column sum
    By juansale in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2011, 01:16 AM
  7. Randomly fill cells with user-entered text
    By bsweet0us in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-21-2010, 11:53 AM

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