Using a macro in multiple files and call another workbook

  • Hi guys, I have this macro that runs perfectly but I would like to use it in multiple files at the same time because right now just runs one at the same time, also I would like a little help because my "DataBase" is in another workbook is not in a sheet of the workbook I am working in, and right now to use the info in the "DataBase" I am adding a need sheet (in my actual workbook) with it, this is not the ideal, the ideal is write in the macro that the "Database" is in another workbook.

    I hope you can help me, thank you in advance

  • Where are all the sheets referred to in the macro?

    You need to explicitly refer to the workbook in your ode.

    What is the workbook with the code in used for?

  • I can't see a sheet being added.

    The code that you posted appears to remove formatting, etc on two sheets in the main workbook.I'm not really sure why you need to adda sheet.

  • If you can see in the next line of code, dbWS is a sheet from the file I am codifying, but actually is not (I have to add it because the macro does not run without that sheet) but "DataBase" is in another workbook what I wantis do not add the sheet of DataBase in every file I am modifying, but call that workbook in my macro.

    Set dbWS = Sheets("DataBase")

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!