Copying sheets to new workbook problem with workbooks.add VBA

RockandGrohl

Well-known Member
Joined
Aug 1, 2018
Messages
810
Office Version
  1. 365
Platform
  1. Windows
Hi all, quick one I hope.

I'm copying 4 tabs from one workbook into a new workbook, only copying the values, formatting and column widths along with the tab name and colour.

I've done this by recording a macro, but have ran into a problem.

When the Macro gets to Workbook.Add, it adds a new workbook, Book1, right?

The problem is if I run this macro again, it'll now be Book2...


Is there a way to open a new workbook and set it as "Output" or something?

Thanks.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
In order to give the workbook a name you need to use
Code:
ActiveWorkbook.SaveAs
 
Upvote 0
Are you only copying these 4 tabs to a new workbook?

If you are you could simply copy them in one go, without a destination, and then you'll have a new workbook with only the tabs you've copied.
 
Upvote 0
Are you only copying these 4 tabs to a new workbook?

If you are you could simply copy them in one go, without a destination, and then you'll have a new workbook with only the tabs you've copied.

I want this to be in a macro button you press which generates a new worksheet to send to someone. The huge formulas in them must be pasted as values.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,159
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