Hello gpops,
There is something in the handling of the Activewindow vs activeWorkbook that does not seem to fit...
This code is oviously in the source document, the document from where you want to copy worksheets, as expected. So the active workbook here is the source Workbook...
Sub CopySelectedSheetsToNewWorkbooks()
This theory is reinforced here, you want to copy each sheet in the source doc
For Each SHT In ActiveWindow.SelectedSheets
Now here you are jumping into saying that the name of the active workbook is actually the NewWB... this strange... unless you want to have the exact same name on two files, which I assume that you dont, since Excel cannot have two filess with same name open at the same time..
NewWB = ActiveWorkbook.Name
Then you want to activate this NewWB, but I dont see it being created...
Workbooks(NewWB).Activate
Maybe I am reading something wrong but it seems to me that you need to make clear objects referring to the different workbooks and avoid as much as possible the "Active". This way you dont have to activate, because you know what you are working with.
Additionally to this, you are copying both Sheet and Cells before pasting anything.... this cannot work as expected...
I havent tested the below, but hopefully it gives you an idea of what I mean...
Bookmarks