Compare | Modules menu command

Use this command to compare 2 Visual Basic Modules.
When you compare 2 workbooks, xlCompare processes all Visual Basic modules, and compare them. But you may want to compare only 2 modules from the both workbooks. Or 2 modules from the same workbook. If you are VBA Code developer - this is common tasks.
This command allows you to compare 2 modules, which are opened on the screen.
Before using this command you should switch to the VBA Module view:
Visual Basic Code Selector
After pressing VB Project button, it became highlighted with green color, and xlCompare displays modules in the Visual Basic Projects.
This is required. xlCompare should know which modules are selected.
Also, you should select 2 different modules. If the same module is selected on the both panes - there is nothing to process.
Results of the comparison are shown exactly in the same form as for the worksheet comparison - in the Difference Browser window:
Example of the VBA Modules Comparison results
When you have comparison results on the screen you can merge Visual Basic code between 2 modules.

See Also: