VBA to copy worksheet and insert at the end all worksheets

nirvehex

Active Member
Joined
Jul 27, 2011
Messages
493
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!
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
73,190
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,879
Messages
5,834,208
Members
430,263
Latest member
abz54

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