When you compare Visual Basic Modules, it is highly important to not only get the difference, but to resolve it, merge changes effectively. If you are working in the team environment on the spreadsheet model, you merge changes with co-workers very often. If you are doing this in the manual mode - this way leads to mistakes and loosing productivity.
With xlCompare you can put your focus on the primary tasks while the xlCompare quickly merge changes in your Visual Basic Code.
Lets look into this Difference Browser:
Every line which represents modification has a checkbox. Addes lines (marked with green + sign), deleted lines (marked with red X) has checkbox near the item. Changed lines has 2 values near the Value 1 and Value 2 columns.
When you press the checkbox, this modification is applied to the another workbook. Added or deleted line appears on the corresponding place in the another file. Changed line it replaced with corresponding value.
If item in the Difference Explorer corresponds to the sub or function - it is added by a single click.
Same checkboxes are present in the VBA Code window:
They work exactly in the same way as in the Difference Browser. If you check the item - it is added to another workbook.
In the VBA Code window you can check multiple items at a time. It allows to select multiple lines of code. If you click on the one of the selected checkboxes - all of them are checked or unchecked.
If you've changed code and want to rollback the modification - just uncheck the appropriate checkbox. Removing the checkmark leads to the restoring original part of the code.
Checkmarks in the VBA Code window and in the Difference Browser are syncronized. Once you've made a merge operation it is reflected in the VBA Code window and in the Difference Explorer.
We've explained how to add code to your module. But you may need to remove part of the code from your file.
Just select the code you need in the VBA Code window and press DELETE key or use Right Click Menu | Delete command:
To undo the operation and restore code - use Undo Delete command from this menu.
Deleted code is marked with diagonal cross lines:
Note. Code is not deleted immediately. It is deleted when you save the workbook, or when you close Difference Browser. So, you can restore deleted block when needed.