Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Moving within the worksheet | Excel Worksheet Functions | |||
Moving a Worksheet | Excel Discussion (Misc queries) | |||
moving a worksheet..? | Excel Discussion (Misc queries) | |||
Moving worksheet | Excel Programming | |||
Need help i moving one worksheet to another | Excel Programming |