+ Reply to Thread
Results 1 to 8 of 8

Repeat a cell value in another column X number of times

  1. #1
    Registered User
    Join Date
    08-29-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Repeat a cell value in another column X number of times

    I am trying to get a macro to repeat to the next record and produce more data.
    I will explain

    I don’t know VB so I found a macro and changed a few values to get it to work for me but it won’t repeat.
    Basically all I want the macro to do is take a number or letter that I put in column A and paste it in column C as many times as I told it in column B.
    And the go back to A2 and repeat the process and pasting that results under the previous.

    IE in A1 A2 A3 are the values 5, B1, 777
    In B1 is the value 3
    When the macro is executed the results in column C would be
    5 in c1, c2 and c3 - b1 on c4,c5, and so on
    I have the macro working for record 1 but that’s all it will do
    The finished data could be put on a separate sheet if that helps
    Also, as I said I copied the macro off the web and don’t know VB so there may well be commands that are not necessary.
    Thanks much in advance. Macro below.

    Please Login or Register  to view this content.
    Last edited by art1234; 08-31-2011 at 02:10 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: need macro repeat help

    Hello art1234,

    Welcome to the Forum!

    If you have an example workbook, you should post it. It will make clear what you want to do and provide a reference for creating the VBA code. This will ensure you get the right solution for your problem.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    08-29-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: need macro repeat help

    file now attached
    Quote Originally Posted by art1234 View Post
    I am trying to get a macro to repeat to the next record and produce more data.
    I will explain

    I don’t know VB so I found a macro and changed a few values to get it to work for me but it won’t repeat.
    Basically all I want the macro to do is take a number or letter that I put in column A and paste it in column C as many times as I told it in column B.
    And the go back to A2 and repeat the process and pasting that results under the previous.

    IE in A1 A2 A3 are the values 5, B1, 777
    In B1 is the value 3
    When the macro is executed the results in column C would be
    5,5,5,B1,B1,B1,777,777,777
    I have the macro working for record 1 but that’s all it will do
    The finished data could be put on a separate sheet if that helps
    Also, as I said I copied the macro off the web and don’t know VB so there may well be commands that are not necessary.
    Thanks much in advance. Macro below.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: need macro repeat help

    Hello art1234,

    Thanks for posting the workbook.

    Does cell C1 contain all the values: 5,5,5,B1,B1,B1,777,777,777 ?

    Does C1 = 5,5,5 and C2 = B1,B1,B1 etc?

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: need macro repeat help

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST

    And please do not quote whole posts
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    08-29-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: need macro repeat help

    trying to create a string of data in one column "C" -
    C1 would be 5 C2 would be 5 C3 would be 5 C4 would be B1

    Quote Originally Posted by Leith Ross View Post
    Hello art1234,

    Thanks for posting the workbook.

    Does cell C1 contain all the values: 5,5,5,B1,B1,B1,777,777,777 ?

    Does C1 = 5,5,5 and C2 = B1,B1,B1 etc?

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: need macro repeat help

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore Moderators' or Administrators' requests - note that this includes requests by senior members as well, if you are unclear about their request or instruction then send a private message to them asking for help. Do not post a reply to a thread where a moderator has requested an action that has not been complied with e.g Title change or Code tags...etc

  8. #8
    Registered User
    Join Date
    08-29-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Repeat a cell value in another column X number of times

    BY Leith Ross

    Here is the macro code to do what you want.
    Please Login or Register  to view this content.
    Last edited by Leith Ross; 08-31-2011 at 02:39 PM. Reason: Corrected code typo

+ 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