View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default How to get the available sheet name

The available sheet names is infinite, because they can be whatever you
want.

If yoiu names are all Sheet1,2, 3, 4 format, try this

iNext = Activeworkbook.Worksheets.Count + 1
Do Until Not SheetExists("Sheet" & iNext)
iNext = iNext + 1
Loop
Woeksheets.Add.Name = "Sheet" & iNext



Function SheetExists(Filename As String)
Dim oSh As Worksheet
On Error Resume Next
Set oSh = ActiveWorkbook.Worksheets(Filename)
On Error GoTo 0
SheetExists = Not oSh Is Nothing
End Function


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"kvenku " wrote in message
...
I need to know the list of sheet name which are available..example
Sheet1,Sheet2,Sheet3...like that

How to add a new sheet with a name given my me thru text box in the
VBA.

It would be very helpful if you do this for me

Thanks
venkatesh.


---
Message posted from http://www.ExcelForum.com/