ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code to copy excel sheet from 1 file to other (https://www.excelbanter.com/excel-programming/354550-code-copy-excel-sheet-1-file-other.html)

ashishprem[_9_]

code to copy excel sheet from 1 file to other
 

Hi, I want to copy one excell sheet fom 1 file to another. The sourc
excel sheet contains some images also. Because of which row by row cop
is not giving the result in the same format as present in the sourc
file.
Is there any code to just replicate the sheet in the same format.
Regards,
Ashis

--
ashishpre
-----------------------------------------------------------------------
ashishprem's Profile: http://www.excelforum.com/member.php...fo&userid=3148
View this thread: http://www.excelforum.com/showthread.php?threadid=51712


Norman Jones

code to copy excel sheet from 1 file to other
 
Hi Ashish,

Try:

'=============
Public Sub Tester001()
Dim srcWB As Workbook
Dim destWB As Workbook
Dim SH As Worksheet

Set srcWB = Workbooks("First Book.xls") '<<=== CHANGE
Set destWB = Workbooks("Second Book.xls") '<<=== CHANGE

Set SH = srcWB.Sheets("Sheet2")

SH.Copy After:=destWB.Sheets(1)


End Sub
'<<=============

Amend the workbook and sheet names to accord with your scenario.


---
Regards,
Norman


"ashishprem" wrote
in message ...

Hi, I want to copy one excell sheet fom 1 file to another. The source
excel sheet contains some images also. Because of which row by row copy
is not giving the result in the same format as present in the source
file.
Is there any code to just replicate the sheet in the same format.
Regards,
Ashish


--
ashishprem
------------------------------------------------------------------------
ashishprem's Profile:
http://www.excelforum.com/member.php...o&userid=31485
View this thread: http://www.excelforum.com/showthread...hreadid=517129





All times are GMT +1. The time now is 04:21 AM.

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