ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving worksheet Data only (https://www.excelbanter.com/excel-programming/350303-saving-worksheet-data-only.html)

jesmin

Saving worksheet Data only
 

Hi All.
I have created a workbook("one"). When I run it(with auto_open()
macro), It generates all the data in its ("Sheet1"). Now I opened
another workbook("two"). How can I just copy the data from "Sheet1" of
"one" workbook to "Sheet1" of "two" workbook.

I tried this way: I have opened "one" workbook already and "Sheet1" is
the active sheet.
-------------------------------------------------------
ThisWorkbook.Saved = False
ThisWorkbook.Worksheets("Sheet1").Copy
Workbooks.Open Filename:="C:\two.xls"
Workbooks("two.xls").Worksheets(1).Select
ActiveSheet.Paste
Workbooks("two.xls").Saved = True
ThisWorkbook.Close
-------------------------
The code is not working. What is the problem?
Thanks


--
jesmin
------------------------------------------------------------------------
jesmin's Profile: http://www.excelforum.com/member.php...o&userid=29540
View this thread: http://www.excelforum.com/showthread...hreadid=500928



All times are GMT +1. The time now is 01:46 AM.

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