|
-
Feb 8th, 2012, 01:29 PM
#1
Thread Starter
New Member
[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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|