ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   coping a entire tab to a new tab (https://www.excelbanter.com/excel-programming/402161-coping-entire-tab-new-tab.html)

Vimal Lalla

coping a entire tab to a new tab
 
Hi

I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out

[email protected]

coping a entire tab to a new tab
 
On Dec 4, 9:59 am, Vimal Lalla
wrote:
Hi

I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out


Hi
Right click the worksheet tab at the bottom. You will see a menu item
for Move or Copy...Click that and in the dialog box click on (move to
end) and click the box for Create Copy. Now right click the worksheet
tab for the copied sheet and click Rename - then type the new name.
I'm assuming by new that you really mean new, and don't want this done
using VBA.
regards
Paul

Vimal Lalla

coping a entire tab to a new tab
 
Hi

thanks for your reply, i need it done using vba

" wrote:

On Dec 4, 9:59 am, Vimal Lalla
wrote:
Hi

I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out


Hi
Right click the worksheet tab at the bottom. You will see a menu item
for Move or Copy...Click that and in the dialog box click on (move to
end) and click the box for Create Copy. Now right click the worksheet
tab for the copied sheet and click Rename - then type the new name.
I'm assuming by new that you really mean new, and don't want this done
using VBA.
regards
Paul


John

coping a entire tab to a new tab
 
Add following to standard vba module.
Code should copy activesheet & rename it to that entered in the inputbox.
If duplicate name found an error will be reported.

Hope helpful

Sub CopySheet()

Dim ShName As Variant
TOP:
ShName = Application.InputBox(prompt:="Enter New Name", Title:="Rename
Worksheet", Type:=2)
If VarType(ShName) = vbBoolean Then
If ShName = False Then
Debug.Print "cancelled"
Exit Sub
End If
End If
On Error Resume Next
If Worksheets(ShName) Is Nothing Then
With ActiveSheet
.Copy after:=Sheets(.Index)
End With
ActiveSheet.Name = StrConv(ShName, vbProperCase)
Else
MsgBox ShName & " Sheet Already Exists"
GoTo TOP
End If
End Sub
--
JB


"Vimal Lalla" wrote:

Hi

I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out


Vimal Lalla

coping a entire tab to a new tab
 
Thanks John for all your help
That works.

"john" wrote:

Add following to standard vba module.
Code should copy activesheet & rename it to that entered in the inputbox.
If duplicate name found an error will be reported.

Hope helpful

Sub CopySheet()

Dim ShName As Variant
TOP:
ShName = Application.InputBox(prompt:="Enter New Name", Title:="Rename
Worksheet", Type:=2)
If VarType(ShName) = vbBoolean Then
If ShName = False Then
Debug.Print "cancelled"
Exit Sub
End If
End If
On Error Resume Next
If Worksheets(ShName) Is Nothing Then
With ActiveSheet
.Copy after:=Sheets(.Index)
End With
ActiveSheet.Name = StrConv(ShName, vbProperCase)
Else
MsgBox ShName & " Sheet Already Exists"
GoTo TOP
End If
End Sub
--
JB


"Vimal Lalla" wrote:

Hi

I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out


Vimal Lalla

coping a entire tab to a new tab
 
i have placed a button on the master page, when i click the button, it
creates the new sheet as i want it to, but it also copies the button, is
there a way to exclude that.

"Vimal Lalla" wrote:

Hi

I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out


[email protected]

coping a entire tab to a new tab
 
On Dec 4, 11:11 am, Vimal Lalla
wrote:
i have placed a button on the master page, when i click the button, it
creates the new sheet as i want it to, but it also copies the button, is
there a way to exclude that.



"Vimal Lalla" wrote:
Hi


I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out- Hide quoted text -


- Show quoted text -


Hi
Dim SheetButton as Button

for each SheetButton in ActiveSheet.Buttons
SheetButton.delete
next SheetButton

insert the loop after the copy
regards
Paul


John

coping a entire tab to a new tab
 
Paul's solution perfectly ok - but if you are only adding 1 button to master
sheet you only need simple change to code:

Sub CopySheet()

Dim ShName As Variant
TOP:
ShName = Application.InputBox(prompt:="Enter New Name", Title:="Rename
Worksheet", Type:=2)
If VarType(ShName) = vbBoolean Then
If ShName = False Then
Debug.Print "cancelled"
Exit Sub
End If
End If
On Error Resume Next
If Worksheets(ShName) Is Nothing Then
With ActiveSheet
.Copy after:=Sheets(.Index)
End With
With ActiveSheet
.Name = StrConv(ShName, vbProperCase)
.Buttons(1).Delete
End With
Else
MsgBox ShName & " Sheet Already Exists"
GoTo TOP
End If
End Sub

Hope helpful
--
JB


"Vimal Lalla" wrote:

i have placed a button on the master page, when i click the button, it
creates the new sheet as i want it to, but it also copies the button, is
there a way to exclude that.

"Vimal Lalla" wrote:

Hi

I am new to excel, I have created a master worksheet, i want to copy that
entire worksheet with its formatting to a new worksheet with a different
name, can anyone help me out



All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com