Forum Discussion

perkin_warbeck's avatar
perkin_warbeck
Brass Contributor
May 19, 2021
Solved

I need advice on merging two workbooks, both containing VBA code

There are dozens of web sites that tell you how to merge multiple workbooks into a single workbook, but none of them considers that the workbooks might contain VBA code. I want to merge two workbooks...
  • HansVogelaar's avatar
    May 19, 2021

    perkin_warbeck 

    You will have to check defined names before merging.

    Based on your description, I'd create a copy of the first workbook, either in File Explorer from outside Excel, or by using File > Save As from within Excel.

    Open the copy and the second workbook.

    You can then copy or move the sheets from the second workbook into the copy of the first one.

    In the Visual Basic Editor, drag Module1 from the VBA project of the second workbook and drop it onto the VBA project of the other one. It will be renamed automatically.

Resources