Compare VBA Code in Excel | VBA Diff

xlCompare is your VBA Diff tool to compare and merge VBA projects in the Excel files

Compare VBA Code in Excel files

xlCompare compares VBA projects in the Excel files for differences. You get comprehensive report for the compared VBA code modules.

Compare VBA Forms in Excel files

xlCompare compared Forms and Controls in the VBA projects in the Excel files. If something was changed on the VBA Form, you will be pointed to this modification.

Merge changes in the VBA Code

How to merge changes in the VBA projects? Forget about it if you are using xlCompare. Armed with this tool you don't need to export your code and import it back. All merge operations are done in xlCompare. In a few clicks you will get your job done.

Compare VBA code with VBA diff tool xlCompare VBA Diff Tool (xlCompare©) in the action


Benefits of the VBA Diff tool xlCompare

Unfortunately, Microsoft Excel doesn't offer an effective way to compare and merge VBA modules in the Excel files. For VBA developers this became a real pain to find differences and resolve them, if something in the VBA projects has been changed.
So, the typical procedure to compare VBA code looks like this:
  1. Export VBA module from file 1 into text file
  2. Export VBA module from file 2 into other text file
  3. Compare two text files using text comparison tool (or paste contents into Word and compare contents of two files)
  4. Analyze the differences in the text files
What about if your workbooks have 30 VBA modules in each file?
Imaging time spent to this job!
So, xlCompare looks perfect alternative to this method and gives you following advantages:


All you need is to drop your Excel files into xlCompare. One click and you get results on your screen!


xlCompare greatly minimize time you need to spend to compare VBA code. This tool can save you hours of working time. If you multiply this time difference on your hourly rate you will see value of this tool.


xlCompare has all possible functions you need to compare VBA projects in your Excel files.
Compare VBA code - inserted lines

How to compare VBA Code in Excel file for differences

Below we've placed step-by-step instruction on how to compare two Excel files for differences in the VBA code.
  1. Drop your Excel files into xlCompare window from the Windows explorer.
  2. After second file is dropped, xlCompare immediately gives you Comparison Wizard window. Comparison Wizard is a window where you can select pairs of compared worksheets, VBA modules and VBA forms.
    If your workbooks have similar structure - just click Compare button. Otherwise, select VBA tab and make sure that VBA modules are linked properly.
    VBA diff tool | Comparison Wizard
    Complete this Wizard by clicking Compare button.
  3. Results from the compared VBA modules are on your screen
    Compare VBA code
That's all you need to do. Just in a few simple clicks you get results on your screen.
Compare this procedure with the exporting VBA code, that was described above. xlCompare looks much more effective, right?

Merge VBA Code in Excel

Compare VBA code is just a part of the VBA diff process. Usually, you need to see the differences and merge the changes in VBA code after you've found them.
In case of you are going to do it yourself, be ready to export and import all the modules in your Excel files and spend a half of your working day, if you have really large workbook.
xlCompare gives you several options you can use to merge VBA code.

Merge specific lines in VBA code

  1. Select line you need to merge in the VBA Editor
  2. Click the check box before this line
You see that this line appears in the corresponding module.
That's all. If you save the Excel file right now - new VBA code will be saved.

Merge all lines in the VBA code module

  1. Click in the master module, that contains code to be copied and press Ctrl+A. This hotkey selects all lines in the editor.
  2. Click on the any of the checkboxes in this panel.
  3. All the code was copied into the other VBA project.
Save your Excel file to complete the operation.
Looks very simple and easy right?

Compare VBA Forms in Excel workbook

There are only two methods to compare VBA forms in your VBA projects:
  1. Use xlCompare
  2. Compare VBA Forms manually
Second method is just a wasting your time. It is very time-consuming work with high risk of error. So, we don't recommend it.

xlCompare compares VBA Forms as easy as VBA code

xlCompare has own Visual Basic Viewer that shows contents of the Visual Basic project, including all forms and controls. In the screenshot below you see structure of the Form, represented in the hierarchical tree form. You can browse all controls in the native way.
Compare VBA code - browse forms
Browse contents of the VBA project in xlCompare
Look into the image below. xlCompare highlights controls that was added in one of the versions of the Form.
Compare VBA code - added controls

Using xlCompare with SVN\GIT tools

Most of the VBA developers use SVN\GIT tools for version controls. Version controls for VBA code task is important if you are working in the team environment and need to resolve editing conflicts regularly.
In this case, xlCompare is a must have tool for you. It can be used in the SVN\GIT environment as external diff viewer for Excel files. This allows you to compare and merge VBA code right in the xlCompare, without exporting it.
Visit this page to get more information on integration with SVN.

Conclusion: xlCompare is an effective VBA Diff Tool

You see that xlCompare makes complex work simple. It is a feature rich tool that allows you to quickly without any efforts compare and merge VBA code in the Excel files.
Armed with xlCompare you will be much more productive and save a lot of your working time.
Compare VBA forms