Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Generating a List of Macros.
Written by Allen Wyatt (last updated August 22, 2020)
This tip applies to Excel 97, 2000, 2002, and 2003
Once you start writing Excel macros, it is easy to get quite a few of them in a workbook. At some point you may want to generate a list of macros in your workbook. There is no intrinsic way within Excel to create a list of macros. You can, however, create a macro that will list your macros. (Sort of sounds redundant, doesn't it?)
As an example, consider the following macro, which steps through all the projects in your workbook to garner all the macro names and place them in a worksheet:
Sub ListMacros()
Dim VBComp As VBComponent
Dim VBCodeMod As CodeModule
Dim oListsheet As Object
Dim StartLine As Long
Dim ProcName As String
Dim iCount As Integer
Application.ScreenUpdating = False
On Error Resume Next
Set oListsheet = ActiveWorkbook.Worksheets.Add
iCount = 1
oListsheet.[a1] = "Macro"
For Each VBComp In ThisWorkbook.VBProject.VBComponents
Set VBCodeMod = ThisWorkbook.VBProject.VBComponents(VBComp.Name).CodeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine >= .CountOfLines
oListsheet.[a1].Offset(iCount, 0).Value = _
.ProcOfLine(StartLine, vbext_pk_Proc)
iCount = iCount + 1
StartLine = StartLine + _
.ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
Set VBCodeMod = Nothing
Next VBComp
Application.ScreenUpdating = True
End Sub
In order to use this macro, you must make sure you have the Microsoft VBA extensibility reference set. To do this, follow these steps:

Figure 1. The References dialog box.
***Insert Figure X �When you run the macro, it adds a new worksheet to your workbook, and then lists the names of all the macros in all the modules in the workbook.
Note:
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2715) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Generating a List of Macros.
Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel Data Analysis and Business Modeling today!
Got a workbook cluttered with all sorts of macros? Delete them and you'll make your workbook easier to manage.
Discover MoreOpen up a workbook, and Excel normally runs the macros associated with that workbook. You can disable the automatic ...
Discover MoreMacros allow you to perform all sorts of file-related operations. One such operation allows you to delete a directory. ...
Discover MoreFREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
2022-10-29 06:03:25
DavidB
This works OK except it seems not to list Private Subs. Also would it be possible to include which module each macro is is stored in. I seem to have my macros stored in a number of modules and it would be useful to know where each macro is stored.
2022-05-03 17:28:54
Rene
Thanks this is almost exactly what I am trying to do except I want to print the list from my personal macro workbook. Is that possible?
2020-12-31 20:58:19
Peter
This is great. Your code also taught me the .[a1] syntax.
Is it possible to include additional columns for the shortcut keystroke and the description?
Peter
2020-12-29 10:59:13
Sherry Fox
Allen,
Just wanted to say thanks so much for sharing this code! I have seen a few that list the macros within a pop-up message box. But that still forces me to manually copy each name into Excel. Having your macro to list all macros is very helpful during my development. I tag each macro as I "version" them and delete all but my final version for each of the macros I write. Then I re-run your code, and use it to create my metric legend and work instructions for any projects I develop. Anyways I love this macro and will use it constantly. But I have one question, is there any way that this macro can be modified to list macros within the ACTIVE workbook, and the new sheet to the ACTIVE workbook, but be run from the PERSONAL workbook. I ask as I have been constantly copying this code into multiple development workbooks from my Personal workbook. Thanks again.
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments