Move selected sheets to different workbook

DeeEmmEss

New Member
Joined
Nov 25, 2015
Messages
43
I have a simple problem that I cannot solve. A VBA routine I run daily creates a workbook (Book1) which I have declared as wb2 and imports sheets from various sources, manipulates certain data, renames the sheets, then selects all sheets. This works well and has done so for many nonths. I then wish to move all these selected sheets to the end of another open workbook (which I have declared wb1, currently RRAugust22.xlsm - but changes each month, always with RR prefix), but am having difficulty doing so. I currently transfer them manually with move/copy command, and then have another routine which further manipulates the data. I am trying with wb2.SelectedSheets.Move after:=wb1.Sheets.Count but cannot get it to work. Please ease my frustration.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
VBA Code:
wb2.SelectedSheets.Move after:=wb1.Sheets.Count

wb2 is a workbook object consisting of properties and methods. "SelectedSheets" is not a valid property or method of the worksheet object. Recommend that you use the macro recorder and record yourself manually performing the action you want, then inspect the VBA code in the recorded macro to learn what the proper syntax should be.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,063
Messages
6,122,934
Members
449,094
Latest member
teemeren

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