Macro to Copy/Move to End a new Worksheet

JaredMcCullough

Well-known Member
Joined
Aug 1, 2011
Messages
516
Looking for some help creating a Macro to initiate a New Worksheet cycle. Preferably looking to use a VBA Command button to initiate the process. What I am wanting it to do is copy the second "Worksheet" in the series (ex. Sheet2) and Move to End of worksheets thus creating a copy of the second worksheet as a new template to work on. This is the first sequence of events in the over all goal I just figured it would be best to start one at a time.
 
Try:
Code:
Sub CopySheet()
    Application.ScreenUpdating = False
    Dim sName As String
    Dim sCode As String
    sName = InputBox("Please enter a name for the sheet.")
    sCode = InputBox("Please enter a code for the sheet.")
    Sheets("B").Copy After:=Sheets(Sheets.Count)
    With ActiveSheet
        .Name = sName
        .UsedRange.Offset(1, 0).ClearContents
        .UsedRange.Offset(1, 0).Interior.ColorIndex = xlNone
        .UsedRange.Offset(1, 0).Borders.LineStyle = xlNone
    End With
    Sheets("Sheet2").Cells(Rows.Count, "M").End(xlUp).Offset(1, 0) = sName
    Sheets("Sheet2").Cells(Rows.Count, "N").End(xlUp).Offset(1, 0) = sCode
    Application.ScreenUpdating = True
End Sub
Mumps,
I was looking to add a portion to the code where sCode is added to cell "W1" of the copied worksheet. Could you help me come up with the context for how to do this.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hi Jared. Add this line:
Code:
.Range("W1") = sCode
below this line:
Code:
.Name = sName
 
Upvote 0

Forum statistics

Threads
1,216,222
Messages
6,129,586
Members
449,520
Latest member
TBFrieds

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top