Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
johnT
 
Posts: n/a
Default Extracting worksheet names....

Hello,

I use the following formula to display worksheet names in
a cell:

=MID(CELL("filename",A1),FIND("]",CELL("filename",A1))
+1,255)

Is there a way to list the names of all the worksheets in
the entire workbook on one sheet?

(thanks)
  #2   Report Post  
Mangesh Yadav via OfficeKB.com
 
Posts: n/a
Default

run the following code:

Sub test()

Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next

End Sub


place it in any module to run it.

- Mangesh

--
Message posted via http://www.officekb.com
  #3   Report Post  
johnT
 
Posts: n/a
Default

thanks, but is there a way to automatically update the
list if i was to insert another worksheet??
-----Original Message-----
run the following code:

Sub test()

Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next

End Sub


place it in any module to run it.

- Mangesh

--
Message posted via http://www.officekb.com
.

  #4   Report Post  
LanceB
 
Posts: n/a
Default

You could place Mangesh's example in "ThisWorkbook" code page

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next
End Sub


"johnT" wrote:

thanks, but is there a way to automatically update the
list if i was to insert another worksheet??
-----Original Message-----
run the following code:

Sub test()

Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next

End Sub


place it in any module to run it.

- Mangesh

--
Message posted via http://www.officekb.com
.


  #5   Report Post  
johnT
 
Posts: n/a
Default

i can't seem to get this working???
-----Original Message-----
You could place Mangesh's example in "ThisWorkbook" code

page

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next
End Sub


"johnT" wrote:

thanks, but is there a way to automatically update the
list if i was to insert another worksheet??
-----Original Message-----
run the following code:

Sub test()

Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next

End Sub


place it in any module to run it.

- Mangesh

--
Message posted via http://www.officekb.com
.


.



  #6   Report Post  
LanceB
 
Posts: n/a
Default

In the visual basic editor right click on the "ThisWorbook" icon and select
view code. Paste the example there. It won't work in a regular code module

"johnT" wrote:

i can't seem to get this working???
-----Original Message-----
You could place Mangesh's example in "ThisWorkbook" code

page

Private Sub Workbook_NewSheet(ByVal Sh As Object)
Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next
End Sub


"johnT" wrote:

thanks, but is there a way to automatically update the
list if i was to insert another worksheet??
-----Original Message-----
run the following code:

Sub test()

Set rng = Worksheets("Sheet1").Range("A1")
i = 1

For Each sht In Worksheets
rng(i, 1) = sht.Name
i = i + 1
Next

End Sub


place it in any module to run it.

- Mangesh

--
Message posted via http://www.officekb.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
Autofill Worksheet names Bonnie Setting up and Configuration of Excel 1 March 3rd 05 08:24 PM
How do I print a list of worksheet tab names in a workbook Clif Excel Worksheet Functions 3 March 2nd 05 09:38 PM
drop down menu containing worksheet names J-Rad Excel Worksheet Functions 3 February 1st 05 03:25 AM
How to link Excel worksheet tab names to dates in each worksheet? Pat Excel Worksheet Functions 9 January 31st 05 07:51 AM
Dynamic Worksheet Names JClub Excel Worksheet Functions 1 January 10th 05 08:55 PM


All times are GMT +1. The time now is 06:41 AM.

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"