View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bassman62 Bassman62 is offline
external usenet poster
 
Posts: 117
Default udf for returning names of wrkshts in active workbook

I regret that my reply did not display. I'll try here.
Thank you for your suggestion.
I was hoping for a User Defined Function so that the reference would remain
updated in the event a worksheet name was changed. I suppose I could trigger
the procedure with a Change Event.
Thank you again for your reply.


"ryguy7272" wrote in message
...
List all Sheets in the Book:
Sub ListSheets()
'list of sheet names starting at A1
Dim rng As Range
Dim i As Integer
Set rng = Range("A1")
For Each Sheet In ActiveWorkbook.Sheets
rng.Offset(i, 0).Value = Sheet.Name
i = i + 1
Next Sheet
End Sub

List Sheets in the Book, 30 at a time, then shift over, list 30, repeat:
Sub ShowNames_Click()
Dim wkbkToCount As Workbook
Dim ws As Worksheet
Dim iRow As Integer, iCol As Integer
Set wkbkToCount = ActiveWorkbook
iRow = 2
iCol = 1
For Each ws In wkbkToCount.Worksheets
ActiveSheet.Rows(iRow).Cells(iCol).Value = ws.Name
iRow = iRow + 1
If iRow 30 Then
iRow = 2
iCol = iCol + 1
End If
Next
Range("A1").Select
End Sub

Regards,
Ryan---

--
RyGuy


"Bassman62" wrote:

Using xl-2007;
Is there a UDF one could use to return all of the names of the worksheets
in
the active workbook?
Thanks.