+ Reply to Thread
Results 1 to 3 of 3

Populate Rows from worksheet Names.

  1. #1
    Trever B
    Guest

    Populate Rows from worksheet Names.

    Hi,

    Thanks in advance.

    Have a work sheet called summary.

    In col B starting at row 11 I want to populate it with the names of
    worksheets within the current file. (Excluding Summary).

    The trick is I dont know how many worksheets there are.

    Thanks

    Trev

  2. #2
    Norman Jones
    Guest

    Re: Populate Rows from worksheet Names.

    Hi Trev,

    > In col B starting at row 11 I want to populate it with the names of
    > worksheets within the current file. (Excluding Summary).


    > The trick is I dont know how many worksheets there are.


    Try:
    '=============>>
    Public Sub Tester()
    Dim SH As Object
    Dim i As Long

    For Each SH In ThisWorkbook.Sheets
    With SH
    If UCase(.Name) <> "SUMMARY" Then
    i = i + 1
    Sheets("Summary").Range("B11")(i).Value = .Name
    End If
    End With
    Next SH

    End Sub
    '<<=============


    ---
    Regards,
    Norman



  3. #3
    JMB
    Guest

    RE: Populate Rows from worksheet Names.

    You could use a macro to accomplish that.

    Sub test()
    Dim WkSht As Worksheet
    Dim Count As Long
    Dim rngTarget As Range

    Set rngTarget = Worksheets("Summary").Range("B11")

    For Each WkSht In Worksheets
    If Not WkSht Is rngTarget.Parent Then
    Count = Count + 1
    rngTarget(Count, 1).Value = WkSht.Name
    End If
    Next WkSht
    End Sub

    "Trever B" wrote:

    > Hi,
    >
    > Thanks in advance.
    >
    > Have a work sheet called summary.
    >
    > In col B starting at row 11 I want to populate it with the names of
    > worksheets within the current file. (Excluding Summary).
    >
    > The trick is I dont know how many worksheets there are.
    >
    > Thanks
    >
    > Trev


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1