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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,807
Messages
6,121,679
Members
449,047
Latest member
notmrdurden

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