+ Reply to Thread
Results 1 to 5 of 5

Populate data according to specific numbers

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Populate data according to specific numbers

    Hello
    I have the range("C1:C30") This is the range where I want to populate my data

    The numbers which I will distribute the data according is in C33:C37
    Say for example (5 - 6 - 4 - 10 - 3)

    The total of these number are 28 so the first two cells C1 and C2 will be empty
    From C3:C7 should be filled with "A"
    From C8:C13 should be filled with "B"
    From C14:C17 should be filled with "C"
    From C18:C27 should be filled with "D"
    From C28:C30 should be filled with "E"

    Note that the numbers are variables not constants

    I have solved this part by this code
    Please Login or Register  to view this content.
    Now I want to extend the range to be C33:G37 and to apply the previous code to the columns ("C:G")


    Here's the file
    Attached Files Attached Files

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Populate data according to specific numbers

    Your code may not be exactly what I would have done but here are the minimum changes I was able to make to your code to get it to work for multiple columns:

    Please Login or Register  to view this content.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Populate data according to specific numbers

    thank you very much for your reply
    your code works fine except one thing
    If the total in rows 33:37 less than 30 then the difference should be empty cells
    this happened for your code for column C only but not for other columns

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Populate data according to specific numbers

    I have found the solution Mr. Jazzer
    Here's my working code
    Please Login or Register  to view this content.
    Thanks for offering great help

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Populate data according to specific numbers

    عفوا

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved:

    Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

+ 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. Populate a list of data from specific worksheets
    By Emou in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2014, 02:51 PM
  2. Auto-populate specific data from one sheet to another
    By fowlspace in forum Excel General
    Replies: 4
    Last Post: 10-17-2012, 09:19 PM
  3. Userform populate specific cell with data
    By kmcarter in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2011, 10:33 AM
  4. Replies: 7
    Last Post: 04-09-2010, 11:37 AM
  5. Replies: 15
    Last Post: 10-11-2009, 11:46 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