Cant run macro on desired sheet

cuetipper

Board Regular
Joined
Nov 9, 2018
Messages
67
New to the board and macros. I have a macro I am running from my personal workbook.
It runs on whatever workbook / worksheet I focus on. But during the process it creates temporary worksheets and it is doing so in the personal workbook. If the sheet is closed the temps stay in the
personal workbook until I close it. I would like for the temp worksheets to be created in the focused workbook and not the personal work book so when I close it they go away.

what code do I need to add?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
activate the desired workbook in the vba first, and then add the sheet, as shown below

Code:
    Workbooks("Book2.xlsx").Activate
    Sheets.Add After:=ActiveSheet
 
Upvote 0
what code do I need to add?
It might help if we saw the code. If the personal workbook is hidden then you shouldn't need to activate the "desired workbook" as it should be the activeworkbook already but can't really tell as we haven't seen your code.
 
Upvote 0
The code is not complete. And the personal workbookis hidden. So how can I force it to stay fpocused on the aactive workbook.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top