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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,117
Messages
5,857,482
Members
431,882
Latest member
saaaaaaaaaaaaaaaaaaaaaa

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