View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
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