ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   add new named sheet (https://www.excelbanter.com/excel-programming/290648-add-new-named-sheet.html)

Greg Carter

add new named sheet
 
I want to add a worksheet to the workbook with a specific
name that is in a cell on an existing worksheet.
How can this be done??

Thanx ahead,
G. Carter

Dave Peterson[_3_]

add new named sheet
 
One way:

Option Explicit
Sub testme01()

Dim newWks As Worksheet

Set newWks = Worksheets.Add
On Error Resume Next
newWks.Name = Worksheets("sheet1").Range("a1").Value
If Err.Number < 0 Then
MsgBox "couldn't rename sheet: " & newWks.Name
Err.Clear
End If
On Error Goto 0

End Sub



GREG CARTER wrote:

I want to add a worksheet to the workbook with a specific
name that is in a cell on an existing worksheet.
How can this be done??

Thanx ahead,
G. Carter


--

Dave Peterson


Tom Ogilvy

add new named sheet
 
Worksheets.Add(After:=worksheets( _
worksheets.count)).Name = Activesheet.Range("B9").Value

or
sName = Activesheet.Range("B9").Value
Worksheets.Add(After:=worksheets(worksheets.count) )
Activesheet.Name = sName


--
Regards,
Tom Ogilvy



GREG CARTER wrote in message
...
I want to add a worksheet to the workbook with a specific
name that is in a cell on an existing worksheet.
How can this be done??

Thanx ahead,
G. Carter





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

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