Trick to Move Worksheet to other Workbook

seageath

Board Regular
Joined
Oct 29, 2009
Messages
102
Hi all,

I have tricky case that I need to solve related to the following Workbook.
Say that workbook A is a template where I do most of the calculation and process.
And workbook B is the final workbook / file that I use to save the final result.
In my macro, I selected specific worksheet(s) in A to be moved in to B.

Currently I do like the following

Code:
Do 
Select case Ws.Name
Case 1
Case 2
Case 3
While WS.Count = 10

But sometimes (not always) not all selected WS being moved to B, mostly missed 1.
I knew somehow in the code is not correct, but not sure how to fix it.
Any idea how is the logic to (always) move them correctly without miss the worksheet.

Thanks.

-sea-
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Have you tried something like this?

Code:
Dim ws As Worksheet
 
    For Each ws In Worksheets
        ' your move code here
    Next ws
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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