Option Explicit
'======================
Sub Liste_Sub()
Dim o As Object, i&, t$, Nom$, Liste$(), n&, c As Range
Dim Col%
'--------- liste des procédures Sub -------
For Each o In ThisWorkbook.VBProject.VBComponents
With o.codemodule
For i = 1 To .CountOfLines
t = " " & Trim(.Lines(i, 1))
Nom = .ProcOfLine(i, 0)
If t Like "* Sub " & Nom & "(*)" Then
If t Like " Sub " & Nom & "()" Then
n = n + 1
ReDim Preserve Liste(1 To 2, 1 To n)
Liste(1, n) = o.Name 'nom du module
Liste(2, n) = Nom 'nom de la macro
End If
i = i + .ProcCountLines(Nom, 0) - 1 'saute les lignes
End If
Next
End With
Next
'-------- Ajout Feuille --------
Sheets.Add
Col = 2
'----------- Affichage ----------
Cells(1, Col).Value = "Liste des SUB"
Cells(2, Col).Value = "Nom du Module"
Cells(2, Col + 1).Value = "Nom de la macro"
For i = 1 To n
Cells(i + 2, Col).Value = Liste(1, i)
Cells(i + 2, Col + 1).Value = Liste(2, i)
Next i
Range("B:C").EntireColumn.AutoFit
Range(Cells(1, Col), Cells(1, Col + 1)).Merge
Range(Cells(1, Col), Cells(2, Col + 1)).HorizontalAlignment = xlCenter
With Range(Cells(1, Col), Cells(2, Col + 1)).Borders
.LineStyle = xlContinuous
.Weight = xlMedium
End With
ActiveSheet.Delete
End Sub
'=======================