Moving tabs to another workbook

krishna334

Active Member
Joined
May 22, 2009
Messages
391
Hi All,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
I have 2 excel files “Test” and High Value in a specific folder in my D drive.
“Test” is a blank workbook.
“High Value” has 2 tabs – “Days” & “Value”.
What I need is a macro in which can move both the tabs in High Value to Test.
Hope this is simple.
<o:p> </o:p>
Advance Thanks for any help.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Try this, make sure the one that has the tabs in is opened second

Sub Macro1()
' Move sheets
Dim ws1 As Workbook
Dim ws2 As Workbook
Set ws1 = "D:\Path\.xls"
Set ws2 = "D:\Path\.xls"
Workbooks.Open ws1
Workbooks.Open ws2

Sheets(Array("Days", "Values")).Select
Sheets("Values").Activate
Sheets(Array("Days", "Values")).Move Before:=Workbooks(ws1).Sheets(4)
End Sub
 
Upvote 0
Just alter the path yourself and also place in the workbook names where you see ws1 and ws2

so change

"D:\Path\.xls"

To your path and workbook name, you need the .xls after the workbook name
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,723
Members
452,939
Latest member
WCrawford

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