![]() |
Creating and naming new worksheets
I have macro to make a new sheet from a template. In this process, the user
is asked for an account name which is then used to name the sheet. How do I check to make sure that the same name does not already exist? Thanks, BradK |
Creating and naming new worksheets
Hi Brad
You can use this function to check it Function SheetExists(SName As String, _ Optional ByVal WB As Workbook) As Boolean 'Chip Pearson On Error Resume Next If WB Is Nothing Then Set WB = ThisWorkbook SheetExists = CBool(Len(WB.Sheets(SName).Name)) End Function And use If SheetExists(yourstring) = False Then..... -- Regards Ron de Bruin http://www.rondebruin.nl "Brad K." wrote in message ... I have macro to make a new sheet from a template. In this process, the user is asked for an account name which is then used to name the sheet. How do I check to make sure that the same name does not already exist? Thanks, BradK |
All times are GMT +1. The time now is 03:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com