Simple copy sheet VBA code

Paris0022

New Member
Joined
May 17, 2015
Messages
30
I have a sheet called “Rent Roll”. I am looking for a simple Macro VBA code to copy the Rent Roll data sheet into a new sheet called Rent Roll Proforma.

Basically I would like to have a format control button linked to a macro and when clicked, it will copy the data in the Rent Roll tab into my new sheet.

Thanks for your help.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
You can put a button on the worksheet after the code is installed in code module1 by clicking Developer on the Ribbon, then click Insert. Left click the button icon in the Form Controls tool box, then move the cross hairs (+) to where you want the button and click again. A pop up menu will display from which you can click 'Attach a Macro' and use the dialog box that appears to select the macro you want to attach to the button.

Code:
Sub copyRentRoll()
Sheets("Rent Roll").Copy After:=ThisWorkbook.Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = "Rent Roll Proforma"
End Sub
 
Last edited:
Upvote 0
Try this:
Code:
Sub Copy_My_Sheet()
'Modified  4/20/2019  3:08:15 PM  EDT
Sheets("Rent Roll").Copy after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Rent Roll Proforma"
End Sub
 
Upvote 0
Try this:
Code:
Sub copier()
    Dim wsh As Worksheet, wsh2 As Worksheet
    Set wsh = ThisWorkbook.Worksheets("Rent Roll")
    wsh.Copy , wsh
    Set wsh2 = ThisWorkbook.ActiveSheet
    wsh2.Name = "Rent Roll Proforma"
    wsh2.UsedRange.Formula = wsh.UsedRange.Value
    Set wsh = Nothing
    Set wsh2 = Nothing
End Sub
 
Upvote 0
Thank you for your replies. What if I already have a Rent Roll Pro forma Tab already created. I have a button with a macro and it will say, copy Rent Roll sheet into this sheet.

What code would that be? I see the code you give me will be creating a sheet. But I already have the sheet created and just want it copied over.
 
Upvote 0
How about
Code:
Sub Paris0022()
   Sheets("Rent Roll").UsedRange.Copy Sheets("Rent Roll Proforma").Range("A1")
End Sub
 
Upvote 0
Thank you for your replies. What if I already have a Rent Roll Pro forma Tab already created. I have a button with a macro and it will say, copy Rent Roll sheet into this sheet.

What code would that be? I see the code you give me will be creating a sheet. But I already have the sheet created and just want it copied over.

Be careful how you word your posts. "New" means it does not currently exist.
copy the Rent Roll data sheet into a new sheet called Rent Roll Proforma
 
Upvote 0

Forum statistics

Threads
1,214,411
Messages
6,119,356
Members
448,888
Latest member
Arle8907

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