+ Reply to Thread
Results 1 to 5 of 5

Loop based on frequncy in cells

  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    Gothenburg, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    6

    Loop based on frequncy in cells

    Hi,

    I have a list in column A with data. In column B is frequency of data that i will have in column D. I try to make a VBA code which will copy value from A1 and paste it in D1,D2,D3 based od value in B1. So if I have:


    (A1) AAA (B1) 3
    (A2) BBB (B2) 2
    (A3) CCC (B3) 3


    I would like to have another column (D) with data

    (D1) AAA
    (D2) AAA
    (D3) AAA
    (D4) BBB
    (D5) BBB
    (D6) CCC
    (D7) CCC
    (D8) CCC

    Copy value in A and paste it in D based od Frequency given in column B.

    Thanks
    Last edited by arbeg; 12-06-2010 at 07:53 AM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,544

    Re: Loop based on frequncy in cells

    Ae you hoping for a formula solution or VBA?

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Loop based on frequncy in cells

    Try this
    Please Login or Register  to view this content.
    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  4. #4
    Registered User
    Join Date
    11-29-2010
    Location
    Gothenburg, Sweden
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Loop based on frequncy in cells

    Thanks, it works

    I solve it by myself same day, but your code looks better then my. I have bunch of variables and i have to define rows. I have learned myself something new from your post. Thanks again. Here is my solution which works but looks horrible


    Please Login or Register  to view this content.

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Loop based on frequncy in cells

    Better you try understanding the code I offered.
    You should not then need to change variable values if the column lengths change.

    Also there is no need to copy the cell then paste to a new location.
    Select > Copy > Paste is inefficient and slows the code down considerably, just assign the values directly.

+ 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