Hiya
The basic code you need is as follows:
Sub Add_Worksheet_Name_From_Cell()
Dim NumberSheets As Integer
NumberSheets = ActiveWorkbook.Worksheets.Count
Sheets.Add After:=Sheets(NumberSheets)
ActiveSheet.Name = Sheet1.[B2].Value
Sheet1.Activate
End Sub
The above will add a new sheet to the end of the existing sheets and name it based on the value in cell B1 on Sheet1
You might need to build in some checks to ensure that the "naming cell is not blank, contains no more than 31 characters and does not contain any illegal characters for sheet names (these are : \ / ? * [ and ] )
Phil, something like this may help....
change as required.....
Sub AddSheet_NameFromCell()
Dim NewSheetName As String
Dim lastSh As String
lastSh = ActiveSheet.Name
NewSheetName = Sheets("YourSheet").Range("YourcellRange")
ActiveWorkbook.Sheets.Add after:=Worksheets(Worksheets.Count)
On Error Resume Next
ActiveSheet.Name = NewSheetName
If Err.Number = 1004 Then
Application.DisplayAlerts = False
ActiveSheet.Delete
MsgBox Err.Number & " : " & Err.Description, _
vbMsgBoxHelpButton + vbOKOnly, "Sheet ErrorAdd", _
Err.HelpFile, Err.HelpContext
Err.Clear
Sheets(lastSh).Activate
Application.DisplayAlerts = True
End If
End Sub
Ivan
Didn't see your answer JAF ;-)