To request the actual code structure of your project, you need to allow access to the VBA project object model (Excel options> Trust Center> Macro options, and then add a link to Microsoft Visual Basic for vX extensibility), where vX is version 5.3. You can use the objects in this to determine which sheets have some kind of code inside them.
However, I would recommend doing it differently.
Instead, iterate through the worksheets in your workbook, and then run the macro in Application Shell using Application.Run
Please note that it would be better to process your code and put it in a standard module, and then pass it to the worksheets as arguments (see my second example)
eg:.
'With code distributed in each worksheet Sub blah() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets On Error Resume Next Application.Run ws.CodeName & ".CollectInfoMacro" If Err.Number = 1004 Then Debug.Print "Skipping "; ws.Name; ", No macro defined" On Error GoTo 0 Next ws End Sub 'Otherwise, better practice would be to refactor 'and not have code on each sheet, instead in a standard module: Sub blahblah() Dim ws As Worksheet Dim results As Collection Set results = New Collection For Each ws In ThisWorkbook.Worksheets If ws.Name <> "Summary" Then 'or whatever results.Add getYourInfoForTheSummary(ws), ws.Name End If Next ws 'Process your results (ie dump to the summary worksheet etc) ... End Sub Function getYourInfoForTheSummary(ws As Worksheet) As Collection 'or return whatever Dim results As Collection Set results = New Collection With ws 'do something End With Set getYourInfoForTheSummary = results 'or whatever End Function
source share