Copy and Paste entire sheet while changing formulas and code

TrezzIII

New Member
Joined
Jul 20, 2018
Messages
1
So I am currently trying to adjust a workbook so on a single button press, it will copy the current worksheet and add it as the next worksheet and rename it "Client Location N" with only the format pasted in. It will also copy and paste another worksheet to the end, that has basically the same information copied over from the first sheet, and will name it 'Simplicity N". I need to make it so the copied sheets match up each time, instead of all populating from the first sheet. I also have code on the first worksheet and it will need to change to reflect the correct page every time. Is it even possible?

Thanks.

Code:
Private Sub CommandButton1_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Client Location 1")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
nextCol = .Cells(50, .Columns.Count).End(xlToLeft).Column + 2
.Range("I50:K55").Copy
.Cells(50, nextCol).PasteSpecial xlPasteFormats
End With
Next i
End Sub

Private Sub CommandButton2_Click()
Dim mySheets
Dim theSheets
Dim i As Long
Dim x As Long
mySheets = Array("Client Location 1")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
nextRow = .Cells(.Rows.Count, 3).End(xlUp).Row + 1
.Range("C84:T84").Copy
.Cells(nextRow, 3).PasteSpecial xlPasteFormats
.Cells(nextRow, 3).PasteSpecial xlPasteValidation
End With
Next i
theSheets = Array("Simplicity 1")
For x = LBound(theSheets) To UBound(mySheets)
With Sheets(theSheets(x))
nextRow = .Cells(85, 3).End(xlDown).Row + 1
.Cells(108, 1).EntireRow.Insert Shift:=xlDown
.Range("C90:AW90").Copy
.Cells(nextRow, 3).PasteSpecial xlPasteFormats
.Cells(nextRow, 3).PasteSpecial xlFormulas
End With
Next x
End Sub

Private Sub CommandButton3_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Client Location 1")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
nextCol = .Cells(65, .Columns.Count).End(xlToLeft).Column + 2
.Range("I65:K68").Copy
.Cells(65, nextCol).PasteSpecial xlPasteFormats
End With
Next i
End Sub

Private Sub CommandButton4_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Client Location 1")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
nextCol = .Cells(50, .Columns.Count).End(xlToLeft).Column + 2
.Range("I50:K55").Copy
.Cells(50, nextCol).PasteSpecial xlPasteFormats
End With
Next i
End Sub

Private Sub CommandButton5_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Client Location 1")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
nextCol = .Cells(65, .Columns.Count).End(xlToLeft).Column + 2
.Range("I65:K68").Copy
.Cells(65, nextCol).PasteSpecial xlPasteFormats
End With
Next i
End Sub

Private Sub CommandButton6_Click()
//will become the button command to copy both worksheets and adjust code.
End Sub
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,214,606
Messages
6,120,497
Members
448,967
Latest member
visheshkotha

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