Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy several sheets from a workbook to a single sheet in a new wor
Hi,
Private Sub CommandButton1_Click() Dim Wbmain As Workbook Workbooks.Open ("C:\Source.xls") Workbooks("Source.xls").Activate Set Wbmain = ActiveWorkbook Call CopySheets(Wbmain) End Sub Sub CopySheets(Wbmain As Workbook) Dim wS As Worksheet Dim wbNew As Workbook Set wbNew = Workbooks.Add For Each wS In Wbmain.Worksheets wS.Copy after:=wbNew.Sheets(wbNew.Sheets.Count) Next wS End Sub Above code creates a new workbook and copy the sheets of the source.xls file in the new workbook.. I need to paste all the contents of source.xls as single sheet in new workbook.. (i.e., if source.xls contains 3 sheets, then all the contents of 3 sheets must be pasted in a single sheet in new workbook).. Can you please help me with some code.. thank you , srikanth |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy several sheets from a workbook to a single sheet in a new wor
Ron has several examples, this one is pretty close to what you want:
http://www.rondebruin.nl/copy3tip.htm Mike F "srikanth" wrote in message ... Hi, Private Sub CommandButton1_Click() Dim Wbmain As Workbook Workbooks.Open ("C:\Source.xls") Workbooks("Source.xls").Activate Set Wbmain = ActiveWorkbook Call CopySheets(Wbmain) End Sub Sub CopySheets(Wbmain As Workbook) Dim wS As Worksheet Dim wbNew As Workbook Set wbNew = Workbooks.Add For Each wS In Wbmain.Worksheets wS.Copy after:=wbNew.Sheets(wbNew.Sheets.Count) Next wS End Sub Above code creates a new workbook and copy the sheets of the source.xls file in the new workbook.. I need to paste all the contents of source.xls as single sheet in new workbook.. (i.e., if source.xls contains 3 sheets, then all the contents of 3 sheets must be pasted in a single sheet in new workbook).. Can you please help me with some code.. thank you , srikanth |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy several sheets from a workbook to a single sheet in a new
Thanks a lot Mike.. I got the code and made some arrangements and it works
fine.. thank you a lot... "Mike Fogleman" wrote: Ron has several examples, this one is pretty close to what you want: http://www.rondebruin.nl/copy3tip.htm Mike F "srikanth" wrote in message ... Hi, Private Sub CommandButton1_Click() Dim Wbmain As Workbook Workbooks.Open ("C:\Source.xls") Workbooks("Source.xls").Activate Set Wbmain = ActiveWorkbook Call CopySheets(Wbmain) End Sub Sub CopySheets(Wbmain As Workbook) Dim wS As Worksheet Dim wbNew As Workbook Set wbNew = Workbooks.Add For Each wS In Wbmain.Worksheets wS.Copy after:=wbNew.Sheets(wbNew.Sheets.Count) Next wS End Sub Above code creates a new workbook and copy the sheets of the source.xls file in the new workbook.. I need to paste all the contents of source.xls as single sheet in new workbook.. (i.e., if source.xls contains 3 sheets, then all the contents of 3 sheets must be pasted in a single sheet in new workbook).. Can you please help me with some code.. thank you , srikanth |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
selecting a single sheet from a volume of sheets in a workbook | Excel Worksheet Functions | |||
Copy and paste data from one sheet to another in a single workbook | Excel Programming | |||
copy data in one sheet to multiple sheets in same workbook | Excel Worksheet Functions | |||
in VBA Sheets("mysheet").Copy Befo=Sheets(1) how do i get a reference to the newly created copy of this sheet? | Excel Worksheet Functions | |||
is it possible to use F9 to manually calculate in a single sheet or single workbook? | Excel Discussion (Misc queries) |