ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   copy and paste data (includes groups...) (https://www.excelbanter.com/excel-discussion-misc-queries/170699-copy-paste-data-includes-groups.html)

Miri

copy and paste data (includes groups...)
 
hi,
i need to copy spesific sheet from one workbook to another existing sheet in
other workbook.
both sheets includes Grouping.
i wrote a code that copy and paste, but the actual result is that the
grouping at the end is not related to the new data i pasted.
what should i add to my code in order to copy also the groups.
my code:

Workbooks(NewBook).Sheets("a").Cells.Select
Selection.Copy
...
Workbooks(Activebook).Sheets("b").Select
Range("A1").PasteSpecial Paste:=xlPasteAll
--
Miri Tz.

joel

copy and paste data (includes groups...)
 
I always do worksheet copies like this

Workbooks(NewBook).Sheets("a").cells.Copy _
destination:= Workbooks(Activebook).Sheets("b").cells


Maybe you just want to delete the old sheet and the copy entiore sheet this
copies more info

Workbooks(Activebook).Sheets("b").Delete
Workbooks(NewBook).Sheets("a").Copy _
after:=Workbooks(Activebook).Sheets(1)
ActiveWorkbook.Name = "b"



"Miri" wrote:

hi,
i need to copy spesific sheet from one workbook to another existing sheet in
other workbook.
both sheets includes Grouping.
i wrote a code that copy and paste, but the actual result is that the
grouping at the end is not related to the new data i pasted.
what should i add to my code in order to copy also the groups.
my code:

Workbooks(NewBook).Sheets("a").Cells.Select
Selection.Copy
...
Workbooks(Activebook).Sheets("b").Select
Range("A1").PasteSpecial Paste:=xlPasteAll
--
Miri Tz.



All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com