Results 1 to 9 of 9

Thread: [RESOLVED][VBA] Help with macro to copy worksheet

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    4

    Resolved [RESOLVED][VBA] Help with macro to copy worksheet

    Hi All,
    I'm trying to create a macro that copies the current worksheet and places the copied ws before it. I've gotten as far as below, but that only copies the ws and places it in the second to last tab. Thanks in advance for any help.


    Sub Copysheet()

    Dim i As Integer
    Dim p As Integer
    On Error GoTo out
    i = InputBox("How many copies would you like?", "Making Copies")

    Application.ScreenUpdating = False
    p = 0
    Do
    ActiveSheet.Copy Before:=Sheets(Sheets.Count)
    p = p + 1
    Loop Until p = i
    Application.ScreenUpdating = True
    Exit Sub
    out:
    MsgBox "Copy Cancelled"
    Application.ScreenUpdating = True
    End Sub
    Last edited by newtovba; Feb 8th, 2012 at 03:45 PM. Reason: Better heading

Posting Permissions

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



Click Here to Expand Forum to Full Width