Excel: a simple Do-loop for copy and pasting and making a table The Next CEO of Stack...

Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?

Unclear about dynamic binding

What connection does MS Office have to Netscape Navigator?

What flight has the highest ratio of time difference to flight time?

How to sed chunks text from a stream of files from find

Where do students learn to solve polynomial equations these days?

How to scale a tikZ image which is within a figure environment

Chain wire methods together in Lightning Web Components

Reference request: Grassmannian and Plucker coordinates in type B, C, D

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

How to count occurrences of text in a file?

Writing differences on a blackboard

Why is my new battery behaving weirdly?

"misplaced omit" error when >{centering} columns

How to install OpenCV on Raspbian Stretch?

Would a completely good Muggle be able to use a wand?

What did we know about the Kessel run before the prequels?

INSERT to a table from a database to other (same SQL Server) using Dynamic SQL

Plot of histogram similar to output from @risk

Powershell. How to parse gci Name?

Make solar eclipses exceedingly rare, but still have new moons

0 rank tensor vs 1D vector

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

Does soap repel water?



Excel: a simple Do-loop for copy and pasting and making a table



The Next CEO of Stack OverflowCopy Excel worksheet and maintain relative cell reference in formulasCopy/paste filtered column in Excel - error messageExcel 2010 Macro - Copy cell range with formulas and paste values onlyCopy reference instead of value/formula in Excel?Excel 2010 VBA or formula to find value in dynamic column based off entry (vlookup like) but copy the value and paste the value into the cellAlign rows from different columns (which contain some cells that have identical values) using simple formula in ExcelExcel 2010: Blank pasted cells require activation causing formula issuesIndex/Match for an entire table rather than a single columnExcel: Pasting values clobbers table (i.e. list) objectcommand button execute copy and paste of worksheets into a new workbook and then automatically runs a macro in the new worksheets












1















I wish to do a simple (I think!) Do-loop for the following:
My simple program works as I want it to, but I think there is an easier way as I wish to repeat it 1000 times. Perhaps using some kind of loop? Do-Loop or otherwise. In short I want to:




  1. copy the contents from A1

  2. Paste them into B1

  3. copy cell C1 (it has a simple formula that acts on B1)

  4. copy the 'value' (only) from C1 into D1 (which will be a table of such values)


I wish to do this for A1 to A1000 and get a table of values D1, D2, ..., D1000 (perhaps as a square table). Cells B1 and C1 remain fixed.



My program is below:



Sub PasteSpecial_Examples()

Range("A1").Copy Range("B1")
Range("C1").Copy
Range("D1").PasteSpecial Paste:=xlPasteValues

Range("A2").Copy Range("B1")
Range("C1").Copy
Range("D2").PasteSpecial Paste:=xlPasteValues

Range("A3").Copy Range("B1")
Range("C1").Copy
Range("D3").PasteSpecial Paste:=xlPasteValues

Range("A4").Copy Range("B1")
Range("C1").Copy
Range("D4").PasteSpecial Paste:=xlPasteValues


Application.CutCopyMode = False

End Sub









share|improve this question

























  • You mean to say you want to copy A1:A1000 and Paste them in D1:D1000 ?

    – Rajesh S
    Feb 15 '18 at 9:21











  • No. That would just copy the same values of A1:A1000 into D1:D1000. When I copy A1 (say) into B1 I get a result in C1. It is the result in C1 I wish to copy into D1.

    – user869299
    Feb 15 '18 at 17:13
















1















I wish to do a simple (I think!) Do-loop for the following:
My simple program works as I want it to, but I think there is an easier way as I wish to repeat it 1000 times. Perhaps using some kind of loop? Do-Loop or otherwise. In short I want to:




  1. copy the contents from A1

  2. Paste them into B1

  3. copy cell C1 (it has a simple formula that acts on B1)

  4. copy the 'value' (only) from C1 into D1 (which will be a table of such values)


I wish to do this for A1 to A1000 and get a table of values D1, D2, ..., D1000 (perhaps as a square table). Cells B1 and C1 remain fixed.



My program is below:



Sub PasteSpecial_Examples()

Range("A1").Copy Range("B1")
Range("C1").Copy
Range("D1").PasteSpecial Paste:=xlPasteValues

Range("A2").Copy Range("B1")
Range("C1").Copy
Range("D2").PasteSpecial Paste:=xlPasteValues

Range("A3").Copy Range("B1")
Range("C1").Copy
Range("D3").PasteSpecial Paste:=xlPasteValues

Range("A4").Copy Range("B1")
Range("C1").Copy
Range("D4").PasteSpecial Paste:=xlPasteValues


Application.CutCopyMode = False

End Sub









share|improve this question

























  • You mean to say you want to copy A1:A1000 and Paste them in D1:D1000 ?

    – Rajesh S
    Feb 15 '18 at 9:21











  • No. That would just copy the same values of A1:A1000 into D1:D1000. When I copy A1 (say) into B1 I get a result in C1. It is the result in C1 I wish to copy into D1.

    – user869299
    Feb 15 '18 at 17:13














1












1








1








I wish to do a simple (I think!) Do-loop for the following:
My simple program works as I want it to, but I think there is an easier way as I wish to repeat it 1000 times. Perhaps using some kind of loop? Do-Loop or otherwise. In short I want to:




  1. copy the contents from A1

  2. Paste them into B1

  3. copy cell C1 (it has a simple formula that acts on B1)

  4. copy the 'value' (only) from C1 into D1 (which will be a table of such values)


I wish to do this for A1 to A1000 and get a table of values D1, D2, ..., D1000 (perhaps as a square table). Cells B1 and C1 remain fixed.



My program is below:



Sub PasteSpecial_Examples()

Range("A1").Copy Range("B1")
Range("C1").Copy
Range("D1").PasteSpecial Paste:=xlPasteValues

Range("A2").Copy Range("B1")
Range("C1").Copy
Range("D2").PasteSpecial Paste:=xlPasteValues

Range("A3").Copy Range("B1")
Range("C1").Copy
Range("D3").PasteSpecial Paste:=xlPasteValues

Range("A4").Copy Range("B1")
Range("C1").Copy
Range("D4").PasteSpecial Paste:=xlPasteValues


Application.CutCopyMode = False

End Sub









share|improve this question
















I wish to do a simple (I think!) Do-loop for the following:
My simple program works as I want it to, but I think there is an easier way as I wish to repeat it 1000 times. Perhaps using some kind of loop? Do-Loop or otherwise. In short I want to:




  1. copy the contents from A1

  2. Paste them into B1

  3. copy cell C1 (it has a simple formula that acts on B1)

  4. copy the 'value' (only) from C1 into D1 (which will be a table of such values)


I wish to do this for A1 to A1000 and get a table of values D1, D2, ..., D1000 (perhaps as a square table). Cells B1 and C1 remain fixed.



My program is below:



Sub PasteSpecial_Examples()

Range("A1").Copy Range("B1")
Range("C1").Copy
Range("D1").PasteSpecial Paste:=xlPasteValues

Range("A2").Copy Range("B1")
Range("C1").Copy
Range("D2").PasteSpecial Paste:=xlPasteValues

Range("A3").Copy Range("B1")
Range("C1").Copy
Range("D3").PasteSpecial Paste:=xlPasteValues

Range("A4").Copy Range("B1")
Range("C1").Copy
Range("D4").PasteSpecial Paste:=xlPasteValues


Application.CutCopyMode = False

End Sub






microsoft-excel vba macros copy-paste






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 6 '18 at 12:01









Mokubai

58.1k16139157




58.1k16139157










asked Feb 6 '18 at 11:13









user869299user869299

15115




15115













  • You mean to say you want to copy A1:A1000 and Paste them in D1:D1000 ?

    – Rajesh S
    Feb 15 '18 at 9:21











  • No. That would just copy the same values of A1:A1000 into D1:D1000. When I copy A1 (say) into B1 I get a result in C1. It is the result in C1 I wish to copy into D1.

    – user869299
    Feb 15 '18 at 17:13



















  • You mean to say you want to copy A1:A1000 and Paste them in D1:D1000 ?

    – Rajesh S
    Feb 15 '18 at 9:21











  • No. That would just copy the same values of A1:A1000 into D1:D1000. When I copy A1 (say) into B1 I get a result in C1. It is the result in C1 I wish to copy into D1.

    – user869299
    Feb 15 '18 at 17:13

















You mean to say you want to copy A1:A1000 and Paste them in D1:D1000 ?

– Rajesh S
Feb 15 '18 at 9:21





You mean to say you want to copy A1:A1000 and Paste them in D1:D1000 ?

– Rajesh S
Feb 15 '18 at 9:21













No. That would just copy the same values of A1:A1000 into D1:D1000. When I copy A1 (say) into B1 I get a result in C1. It is the result in C1 I wish to copy into D1.

– user869299
Feb 15 '18 at 17:13





No. That would just copy the same values of A1:A1000 into D1:D1000. When I copy A1 (say) into B1 I get a result in C1. It is the result in C1 I wish to copy into D1.

– user869299
Feb 15 '18 at 17:13










2 Answers
2






active

oldest

votes


















1














Your want a simple For...Next loop:



Sub PasteSpecial_Examples()

For i = 1 To 1000
Range("A" & i).Copy Range("B1")
Range("C1").Copy
Range("D" & i).PasteSpecial Paste:=xlPasteValues
Next i

Application.CutCopyMode = False

End Sub





share|improve this answer































    1














    I have a similar need, with the difference being that I'm trying to work between different worksheets. I am having trouble with the last step.



    I need to:
    1. copy contents from column A sheet 1,
    2. paste to C2 on sheet 2,
    3. copy C3 on sheet 2 (which is dependent upon the value in C2),
    4. paste in column B on sheet 1



    for some reason, when i try to execute step 4, it copies the last value in c3 sheet 2, for the entire column. any information would be GREATLY appreciated!



    my code:
    Sub PasteSpecial_ForLoop()



    For i = 5 To 5000



    Worksheets("List").Range("C" & i).Copy

    Worksheets("Reg100_Calculator").Range("C2").PasteSpecial Paste:=xlPasteValues

    Worksheets("Reg100_Calculator").Range("C3").Copy

    Worksheets("List").Range("A" & i).PasteSpecial Paste:=xlPasteValues


    Next i



    Application.CutCopyMode = False



    End Sub





    share








    New contributor




    jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "3"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1292473%2fexcel-a-simple-do-loop-for-copy-and-pasting-and-making-a-table%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      Your want a simple For...Next loop:



      Sub PasteSpecial_Examples()

      For i = 1 To 1000
      Range("A" & i).Copy Range("B1")
      Range("C1").Copy
      Range("D" & i).PasteSpecial Paste:=xlPasteValues
      Next i

      Application.CutCopyMode = False

      End Sub





      share|improve this answer




























        1














        Your want a simple For...Next loop:



        Sub PasteSpecial_Examples()

        For i = 1 To 1000
        Range("A" & i).Copy Range("B1")
        Range("C1").Copy
        Range("D" & i).PasteSpecial Paste:=xlPasteValues
        Next i

        Application.CutCopyMode = False

        End Sub





        share|improve this answer


























          1












          1








          1







          Your want a simple For...Next loop:



          Sub PasteSpecial_Examples()

          For i = 1 To 1000
          Range("A" & i).Copy Range("B1")
          Range("C1").Copy
          Range("D" & i).PasteSpecial Paste:=xlPasteValues
          Next i

          Application.CutCopyMode = False

          End Sub





          share|improve this answer













          Your want a simple For...Next loop:



          Sub PasteSpecial_Examples()

          For i = 1 To 1000
          Range("A" & i).Copy Range("B1")
          Range("C1").Copy
          Range("D" & i).PasteSpecial Paste:=xlPasteValues
          Next i

          Application.CutCopyMode = False

          End Sub






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Feb 23 '18 at 23:55









          Mario J.Mario J.

          364




          364

























              1














              I have a similar need, with the difference being that I'm trying to work between different worksheets. I am having trouble with the last step.



              I need to:
              1. copy contents from column A sheet 1,
              2. paste to C2 on sheet 2,
              3. copy C3 on sheet 2 (which is dependent upon the value in C2),
              4. paste in column B on sheet 1



              for some reason, when i try to execute step 4, it copies the last value in c3 sheet 2, for the entire column. any information would be GREATLY appreciated!



              my code:
              Sub PasteSpecial_ForLoop()



              For i = 5 To 5000



              Worksheets("List").Range("C" & i).Copy

              Worksheets("Reg100_Calculator").Range("C2").PasteSpecial Paste:=xlPasteValues

              Worksheets("Reg100_Calculator").Range("C3").Copy

              Worksheets("List").Range("A" & i).PasteSpecial Paste:=xlPasteValues


              Next i



              Application.CutCopyMode = False



              End Sub





              share








              New contributor




              jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.

























                1














                I have a similar need, with the difference being that I'm trying to work between different worksheets. I am having trouble with the last step.



                I need to:
                1. copy contents from column A sheet 1,
                2. paste to C2 on sheet 2,
                3. copy C3 on sheet 2 (which is dependent upon the value in C2),
                4. paste in column B on sheet 1



                for some reason, when i try to execute step 4, it copies the last value in c3 sheet 2, for the entire column. any information would be GREATLY appreciated!



                my code:
                Sub PasteSpecial_ForLoop()



                For i = 5 To 5000



                Worksheets("List").Range("C" & i).Copy

                Worksheets("Reg100_Calculator").Range("C2").PasteSpecial Paste:=xlPasteValues

                Worksheets("Reg100_Calculator").Range("C3").Copy

                Worksheets("List").Range("A" & i).PasteSpecial Paste:=xlPasteValues


                Next i



                Application.CutCopyMode = False



                End Sub





                share








                New contributor




                jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.























                  1












                  1








                  1







                  I have a similar need, with the difference being that I'm trying to work between different worksheets. I am having trouble with the last step.



                  I need to:
                  1. copy contents from column A sheet 1,
                  2. paste to C2 on sheet 2,
                  3. copy C3 on sheet 2 (which is dependent upon the value in C2),
                  4. paste in column B on sheet 1



                  for some reason, when i try to execute step 4, it copies the last value in c3 sheet 2, for the entire column. any information would be GREATLY appreciated!



                  my code:
                  Sub PasteSpecial_ForLoop()



                  For i = 5 To 5000



                  Worksheets("List").Range("C" & i).Copy

                  Worksheets("Reg100_Calculator").Range("C2").PasteSpecial Paste:=xlPasteValues

                  Worksheets("Reg100_Calculator").Range("C3").Copy

                  Worksheets("List").Range("A" & i).PasteSpecial Paste:=xlPasteValues


                  Next i



                  Application.CutCopyMode = False



                  End Sub





                  share








                  New contributor




                  jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.










                  I have a similar need, with the difference being that I'm trying to work between different worksheets. I am having trouble with the last step.



                  I need to:
                  1. copy contents from column A sheet 1,
                  2. paste to C2 on sheet 2,
                  3. copy C3 on sheet 2 (which is dependent upon the value in C2),
                  4. paste in column B on sheet 1



                  for some reason, when i try to execute step 4, it copies the last value in c3 sheet 2, for the entire column. any information would be GREATLY appreciated!



                  my code:
                  Sub PasteSpecial_ForLoop()



                  For i = 5 To 5000



                  Worksheets("List").Range("C" & i).Copy

                  Worksheets("Reg100_Calculator").Range("C2").PasteSpecial Paste:=xlPasteValues

                  Worksheets("Reg100_Calculator").Range("C3").Copy

                  Worksheets("List").Range("A" & i).PasteSpecial Paste:=xlPasteValues


                  Next i



                  Application.CutCopyMode = False



                  End Sub






                  share








                  New contributor




                  jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.








                  share


                  share






                  New contributor




                  jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.









                  answered 10 mins ago









                  jhladjhlad

                  11




                  11




                  New contributor




                  jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.





                  New contributor





                  jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






                  jhlad is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                  Check out our Code of Conduct.






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Super User!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1292473%2fexcel-a-simple-do-loop-for-copy-and-pasting-and-making-a-table%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Cannot install PyQt5 The Next CEO of Stack OverflowCannot install tcpreplay 3.4.4cannot...

                      Kapp-Putsch Acontecimentos | Outros artigos | Menu de navegação

                      Why did early computer designers eschew integers? The Next CEO of Stack OverflowWhat register...