new tab

Keith.Jackson

Board Regular
Joined
Mar 31, 2005
Messages
115
what would be a macro to create a new worksheet with the name of a name I have typed in a cell?
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

andyh69uk

New Member
Joined
Nov 23, 2005
Messages
31
Try this:-

Code:
ActiveWorkbook.Sheets.Add after:=Worksheets(Worksheets.Count)
ActiveSheet.Name = Worksheets("Sheet1").Range("A1").Value

This will add a worksheet at the end and name it the value of A1 on Sheet1

Hopes this helps

Andy
 

shajueasow

Well-known Member
Joined
Oct 7, 2004
Messages
1,926
Try this one.

Sub newsheet()
Sheets.Add
ActiveSheet.Name = Sheets("Sheet1").Range("A1").Text
End Sub

Assumed that the name for the new sheet is given in Cell A1 of Sheet1.
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
to check if the sheet already exists add some errorhandling
Code:
Sub create_sheet()
Dim ShName As String
Dim ShExists As Boolean

ShName = Sheets("Sheet1").Range("A1").Text

On Error Resume Next
ShExists = Len(Worksheets(ShName).Name) > 0
On Error GoTo 0

    If ShExists Then
    MsgBox "Worksheet already exists", 48, "Title"
    Else
    ActiveWorkbook.Worksheets.Add After:=Worksheets(Worksheets.Count)
    ActiveSheet.Name = ShName
    End If
    
End Sub
kind regards,
Erik
 

Forum statistics

Threads
1,171,877
Messages
5,878,021
Members
433,311
Latest member
novalion

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
Top