![]() |
How to add a new sheet with a name
Hi I'm trying to add a sheet for so to name it "formulas". How can I do that? -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=500157 |
How to add a new sheet with a name
The following code checks all the worksheets in the workbook to see if there
is sheet named "Formulas" already present in the file. If it does exist, nothing happens, if it doesn't exist a new worksheet is added and named. Sub AddSheet() Dim ws As Worksheet Dim wb As Workbook Dim strName As String Dim blnFound As Boolean Set wb = ActiveWorkbook For Each ws In wb.Worksheets strName = ws.Name If strName = "Formulas" Then blnFound = True Exit For Else blnFound = False End If Next ws If Not blnFound Then ActiveWorkbook.Worksheets.Add ActiveSheet.Name = "Formulas" End If End Sub -- Kevin Backmann "Ctech" wrote: Hi I'm trying to add a sheet for so to name it "formulas". How can I do that? -- Ctech ------------------------------------------------------------------------ Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745 View this thread: http://www.excelforum.com/showthread...hreadid=500157 |
All times are GMT +1. The time now is 12:24 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com