Forum Discussion
tpadkins
Nov 08, 2020Copper Contributor
Not typical copy and paste questions
Is there a way to have a spreadsheet, that is set up already with formulas and some cells protected, and then when I copy to a new page, it transfers the data, clears the unprotected cells and carrie...
NikolinoDE
Nov 09, 2020Platinum Contributor
With the permission of all involved, here is a small proposal for a solution with VBA .
(not tested, but should work)
Sub SheetClone()
Dim ws As Worksheet, wsClone As Worksheet, r as Range, col as range
Set ws = Sheets(1)
With ws
.Copy After:=ws
Set wsClone = Sheets(ws.Index + 1)
wsClone.Name = ws.Name & "_copy"
For Each col In .UsedRange.Columns
wsClone.Columns(col.Column).ColumnWidth = col.ColumnWidth
Next
For Each r In .UsedRange.Rows
wsClone.Rows(r.Row).RowHeight = r.RowHeight
Next
End With
End Sub
I would be happy to know if I could help.
Nikolino
I know that I know nothing (Socrates)