ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   merging excel files in different sheets (https://www.excelbanter.com/excel-programming/302689-merging-excel-files-different-sheets.html)

banavas[_14_]

merging excel files in different sheets
 
Dear Friends,

I have 2 excel files (maybe more) sefor_1 & sefor_2 with 65500 row
each.
I want to copy the contents of sefor_2 in a second sheet of sefor_1.
Using the following code:

' while having the sefor_2 activated
Cells.Copy
Windows("sefor_1").Activate
ActiveWorkbook.Sheets.Add
ActiveSheet.Paste
Sheets("Sheet1").Name = "sefor_2"
Application.CutCopyMode = False

it corrupts at:
Windows("sefor_1").Activate

Any ideas how to overcome this?

Thanks,
G

--
Message posted from http://www.ExcelForum.com


NooK[_15_]

merging excel files in different sheets
 
How about:

Worksheets(Name of the worksheet to be copied from Sefor_2).Cop
after:=WorkBooks("Sefor_1").Sheets(Name of worksheet in Sefor_1)

This should copy the wanted sheet in sefor_2 right after the sheet i
Sefor_1 as a new Sheet.

Best Regards

Noo

--
Message posted from http://www.ExcelForum.com


NooK[_16_]

merging excel files in different sheets
 
How about:

Worksheets(Name of the worksheet to be copied from Sefor_2).Cop
after:=WorkBooks("Sefor_1").Sheets(Name of worksheet in Sefor_1)

This should copy the wanted sheet in sefor_2 right after the sheet i
Sefor_1 as a new Sheet.

Best Regards

Noo

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 06:59 AM.

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