VBA to copy worksheet and insert at the end all worksheets

nirvehex

Well-known Member
Joined
Jul 27, 2011
Messages
503
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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,606
Members
449,089
Latest member
Motoracer88

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