hello! I'm attempting to design a macro that opens an existing workbook, copies a formatted worksheet ("revisions log") into the active workbook as the last sheet, and closes the original source workbook. because I will be calling this macro in multiple workbooks, I need to set the target workbook (variable name TargetFile) as the ActiveWorkbook and will need to store the macro in the Personal Macro Workbook. problem is, when I'm calling a macro from my Personal Macro Workbook, that then becomes the ActiveWorkbook. the attempt to copy the worksheet stops in its tracks.
I've pasted the code below that does exactly what I want when put in a project module that isn't the Personal Macro Workbook (e.g., "Book1.xlsm"). any suggestions on how to get Excel to recognize that the workbook that was active prior to calling the sub-procedure is what I intend to assign to variable TargetFile?
![]()
Please Login or Register to view this content.
Bookmarks