Moving worksheet
Please help:-
There are 2 workbooks and I want to move all the sheets(except the sheet with name ="Sheet1", "Sheet2"...) in "Workbook A" to "Workbook B", how can I write in VB? |
Moving worksheet
Dear AK,
Here is one way to do it: Sub movesheets() Dim ws As Worksheet Dim wbs As Workbook Dim wbd As Workbook Set wbs = Workbooks("Workbook A.xls") Set wbd = Workbooks("Workbook B.xls") For Each ws In wbs.Worksheets If Not (ws.Name = "Sheet1" Or ws.Name = "Sheet2") Then ws.Move after:=wbd.Worksheets(wbd.Worksheets.Count) End If Next ws Set ws = Nothing Set wbs = Nothing Set wbd = Nothing End Sub -- HTHs Martin "ak" wrote: Please help:- There are 2 workbooks and I want to move all the sheets(except the sheet with name ="Sheet1", "Sheet2"...) in "Workbook A" to "Workbook B", how can I write in VB? |
All times are GMT +1. The time now is 09:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com