Macro Do Until Loop Copy from list of values paste into single cell (e.g. b1)

  • Hi,


    This is my first post here, so that you in advance for your help. What a great community!


    I am trying to write a macro that will loop through a list of values of an undetermined number of rows and one by one copy and paste the values into a single cell, each time through loop replacing the value that was just pasted into the single cell, which is referenced by a report template and auto-populates data based on the id of the number


    Here is an example of what the table will look like:


    A B
    1 231 234
    2 232
    3 233
    4 234
    5 235
    6 236
    7 237


    231 would be copied and pasted into B1, then 232 would be copied and pasted into B1, then 233 would be copied and pasted into B1, then 234 would be copied and pasted into B1.....and so on and so forth. In between the copy and past steps there are other steps to add images to a worksheet and save as a pdf.


    I wrote this script to accomplish the goal:



    It goes through once, but doesn't loop. I'm not sure why? Thanks!!!!

  • Re: Macro Do Until Loop Copy from list of values paste into single cell (e.g. b1)


    Please choose to edit your post, then select all the code, push the # icon on the toolbar and re-save your post.


    Your code will then look like this.

    Code
    Sub Test()
    End Sub


    This is called using code tags and it's how you should post all code to this board.

    Bruce :cool:

  • Re: Macro Do Until Loop Copy from list of values paste into single cell (e.g. b1)


    Thank your for the tip! I just changed it and will do so in the future.

  • Re: Macro Do Until Loop Copy from list of values paste into single cell (e.g. b1)


    Quote from the_natural;769718

    Thank your for the tip! I just changed it and will do so in the future.


    Awesome, thanks. :cheers:
    I'll take a look at it.

    Bruce :cool:

  • Re: Macro Do Until Loop Copy from list of values paste into single cell (e.g. b1)


    This sounds like what you want.

    Bruce :cool:

  • Re: Macro Do Until Loop Copy from list of values paste into single cell (e.g. b1)


    Thank you so much skywriter! That worked like a charm. Thanks for helping me understand another way to approach it.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!