Extracting worksheet names for a given workbook

saeidpp

New Member
Joined
Aug 2, 2011
Messages
1
Hi.

I have a macro which runs on a workbook by openning other workbooks and copying their sheets across while formatting them and performing some calculations,

My problem is just one tab (worksheet) that has a different name every month. e.g "Income (july)" and "Income (Aug)".

I have a solution for I do not know how to implement

In the main worksheet (master sheet) I want to use vba code to bring back all the tab names and from there I can use the cell values to pull back data from the "Income tab"

Any ideas how I can implement this?
Thanks you very much for your help
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Welcome to MrExcel board...

try this

Code:
Sub SheetName()
Dim i As Long, LR As Long
Dim sName As String
Application.ScreenUpdating = False
LR = Sheets("Master").Range("A" & Rows.Count).End(xlUp).Row + 1
 
    For i = 1 To ActiveWorkbook.Worksheets.Count
        Sheets(i).Activate
        If Sheets(i).Name <> "Master" Then
            sName = Sheets(i).Name
            Sheets("Master").Cells(LR, 1) = sName
            LR = Sheets("Master").Range("A" & Rows.Count).End(xlUp).Row + 1
        End If
    Next i
MsgBox "Done"
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top