Consulting

Results 1 to 3 of 3

Thread: copy and paste a certain number of times

  1. #1

    copy and paste a certain number of times

    Hello,

    I am working with Page Layout view in Excel.

    I want to copy a page to the next empty page, and then copy that pasted page and copy to the next empty page (the page has some formulas that connects to the last of his page). I want the code to copy and paste a certain number of times, it can be for example 5 or 10 to in the end have 10 pages.

    The code i am using is the following, but it just adds one new page.
    -------------------
    Sub copy()Dim i As Integer
    i = 1


    Do While i < 6

    i = i + 1
    Loop


    Range("K1:T54").copy Range("U1:AD54")

    Application.CutCopyMode = False

    End Sub
    -----------------------------

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,875
    Sub copy()
    Dim i As Integer, RngToCopy As Range
    Set RngToCopy = Range("K1:T54")
    i = 1
    Do While i < 6
      RngToCopy.copy RngToCopy.Offset(, 10)
      Set RngToCopy = RngToCopy.Offset(, 10)
      i = i + 1
    Loop
    End Sub
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    Holly molly!

    Simple code.
    Thank you very much p45cal

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •