VBA to copy worksheet and insert at the end all worksheets

nirvehex

Active Member
Joined
Jul 27, 2011
Messages
489
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have one worksheet named "Bid Template". I'm trying to write a macro that makes a copy of this worksheet, puts the tab at the end of all my other worksheets within the same workbook and renames it "Bid Scrubbed".

Then I want the same macro to insert 4 columns starting at column DV, shifting this column to the right. I want to name the columns "Test 1", "Test 2", "Test 3", "Final Test".

Then I want to paste the entire sheet as Paste Special Values.

Is this a difficult code to write? Can anyone help me out? When I try to record a macro, it breaks for some reason.

Thanks!
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
53,012
Office Version
  1. 365
Platform
  1. Windows
Hiya
Is this what you're after?
Code:
Sub Bidtemp()

    Sheets("Bid Template").Copy After:=Sheets(ThisWorkbook.Sheets.Count)
    ActiveSheet.Name = "Bid Scrubbed"
    With Sheets("Bid Scrubbed")
        .Columns("DV:DY").Insert xlShiftToRight
        .Range("DV1") = "Test 1"
        .Range("DW1") = "Test 2"
        .Range("DX1") = "Test 3"
        .Range("DY1") = "Final Test"
        .Cells.Copy
        .Cells.PasteSpecial xlPasteValues
        .Range("A1").Select
    End With
    Application.CutCopyMode = False


End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,694
Messages
5,597,571
Members
414,156
Latest member
WDMix

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
Top