VBA- Copy Worksheet to multiple worksheets (duplicate worksheet

Joined
Aug 9, 2017
Messages
17
Still new and still learning, I am close, but can't figure out how to get this to work the way I want. Here is what I have:

Code:
Sub copytemplate3()

Dim WS_Count As Integer
Dim I As Integer
WS_Count = ActiveWorkbook.Worksheets.Count
Dim Source As Range
Set Source = ThisWorkbook.Worksheets(2).Range("A1:N26")
' Begin the loop.
For I = 2 To WS_Count
    ThisWorkbook.Worksheets(I).Select ' just select the sheet
    Source.Copy
    Cells.Select
    ActiveSheet.Paste
    
Next I

End Sub

What I really need is the following, but I don't want it renamed as "Vendor Scorecard2" which is a duplicate of my second sheet.

Code:
  Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Vendor Scorecard")
ws1.Copy ThisWorkbook.Sheets(Sheets.Count)

Basically trying to get this second part to loop through the sheets instead of copying and pasting date from a range as in the first example. I need it to look exactly as my "Vendor Scorecard" template(Sheet 2).

In short.... exactly duplicate a sheet called Vendor Scorecard, and paste it into multiple worksheets that follow that sheet all which have different Vendor Names. Make sense? So close, but can't figure out how to to do it.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try:
Code:
Sub copytemplate3()
    Application.ScreenUpdating = False
    Dim ws As Worksheet
    For Each ws In Sheets
        If ws.Name <> "Vendor Scorecard" Then
            Sheets("Vendor Scorecard").Range("A1:N26").Copy ws.Cells(1, 1)
        End If
    Next ws
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
This is technically doing what I have in the original code and not bringing along the formatting, and it also will overwrite any other sheets I have in my workbook. Trying to duplicate the Sheet called Vendor Scorecard, and paste that in all the sheets that follow its name. Copying doesn't bring along formatting. Sheet.Copy does but copying the range doesn't seem to work.


Try:
Code:
Sub copytemplate3()
    Application.ScreenUpdating = False
    Dim ws As Worksheet
    For Each ws In Sheets
        If ws.Name <> "Vendor Scorecard" Then
            Sheets("Vendor Scorecard").Range("A1:N26").Copy ws.Cells(1, 1)
        End If
    Next ws
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
I tried the macro on some dummy sheets and it worked properly copying all the data and formatting. In order not to overwrite any other sheets in your workbook, the question would be what are the names of those sheets?
 
Upvote 0
Perhaps you could upload a copy of your file to a free site such as www.box.com. or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Include a detailed explanation of what you would like to do referring to specific cells and worksheets. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0

Forum statistics

Threads
1,216,216
Messages
6,129,566
Members
449,517
Latest member
Lsmich

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