Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating/Naming New Worksheets Based on Select Cells in Master Worksheet Lilbit Excel Worksheet Functions 2 March 19th 08 05:05 PM
Naming worksheets ozcank[_18_] Excel Programming 5 June 27th 05 12:27 PM
Creating & Naming a New Worksheet teresa Excel Programming 1 December 13th 04 02:18 PM
naming worksheets Shooter Excel Worksheet Functions 1 December 3rd 04 04:09 PM
Worksheets Add & Naming Kevin H. Stecyk[_2_] Excel Programming 4 August 20th 04 05:19 PM


All times are GMT +1. The time now is 08:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"