Rename workbook without saving in VBA

srj1359

New Member
Joined
Mar 5, 2015
Messages
46
Office Version
  1. 2016
Platform
  1. Windows
Hello! I've got a long VBA I'm working on that requires me to take a few worksheets from a saved workbook (Quote Tool) and copy them over to a new workbook. By default, the new workbook is "Book 2," but I'm wondering if there is a way for me to get around this for instances where a person might be doing a few copies and ends up having "Book 3," "Book 4," etc. Here's what I have so far:

Sheets(Array("Account List", "Title List", "Title List Export")).Copy

Sheets("Account List").Select
Application.CutCopyMode = False
Workbooks("Book2").Connections.Add2 _
"WorksheetConnection_Account List!A1:B", "", _
"WORKSHEET;[Book2]Account List", "Account List!A1:B", 7, True, False

If it's helpful, ultimately what I'm trying to do is take the "Account List" sheet and make a pivot table on the "Title List Export" sheet (adding the data to the Data Model), then taking the "Title List" sheet and making a pivot table underneath on the first pivot table on the "Title List Export" sheet (also adding the data to the Data Model).

Thanks in advance!
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,214,978
Messages
6,122,545
Members
449,089
Latest member
davidcom

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