Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default name of worksheet

Is there a VBA function to display on the first worksheet of the
workbook all the names of the worksheets the book contains and puts
them in seperate rows?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default name of worksheet

One way. Execute from the sheet where you want it.

Sub listsheets()
x = 1
For Each Sh In Sheets
Cells(x, 1).Value = Sh.Name
x = x + 1
Next
End Sub

"bluebanker" wrote in message
...
Is there a VBA function to display on the first worksheet of the
workbook all the names of the worksheets the book contains and puts
them in seperate rows?



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default name of worksheet

Take a look at David McRitchie's BuildTOC macro:

http://www.mvps.org/dmcritchie/excel/buildtoc.htm

In article ,
bluebanker wrote:

Is there a VBA function to display on the first worksheet of the
workbook all the names of the worksheets the book contains and puts
them in seperate rows?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default name of worksheet

Bluebanker

he code below will work. Place it in your personal.xls to run with any
open workbook

Sub showSheetNames()
Dim sht As Object
Dim shtNew As Worksheet
Dim x As Integer

On Error Resume Next

With Application
.ScreenUpdating = False
.DisplayAlerts = False
End With

Set shtNew = ActiveWorkbook.Worksheets.Add
shtNew.Name = "Sheet List"
With shtNew.Range("A1:B1")
.Value = Array("Sheet Name", "Type")
.Font.Bold = True
End With

x = 2


For Each sht In ActiveWorkbook.Sheets
If sht.Name < shtNew.Name Then
shtNew.Range("A" & x & ":B" & x).Value = Array(sht.Name,
shtTypeName(sht.Type))
x = x + 1
End If
Next sht

With shtNew
.Columns.AutoFit
End With

With Application
.ScreenUpdating = True
.DisplayAlerts = True
End With

End Sub


--
HTH
Nick Hodge
Southampton, England



"bluebanker" wrote in message
...
Is there a VBA function to display on the first worksheet of the
workbook all the names of the worksheets the book contains and puts
them in seperate rows?



------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



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
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 lukerush Excel Worksheet Functions 2 September 7th 06 05:05 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Charts and Charting in Excel 3 August 24th 06 07:26 PM
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet Aster Excel Worksheet Functions 3 March 12th 06 09:58 AM
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet Ant Waters Excel Programming 1 September 3rd 03 11:34 AM


All times are GMT +1. The time now is 07:34 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"