ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing Cell info to a new Excel file (https://www.excelbanter.com/excel-programming/429805-writing-cell-info-new-excel-file.html)

Steve

Writing Cell info to a new Excel file
 
Hi, wonder if someone can help.

I need to write information from various cells in one file (not in any
particular order) to another file.

The examples I have seen do not show quite what I want and when i try to
adapt them, it doesn't work.

I can open a file but writiig the information seems to be the problem.

Can you please help?

Thanks

Steve

Gary''s Student

Writing Cell info to a new Excel file
 
Say we have two existing files book1.xls and Book3.xls. We want to copy a
cell from someplace in book1 and paste it to somewhere in Book3. We open
both the source and destination book and do the copy/paste.

Sub Macro1()
ChDir "C:\test folder"
Workbooks.Open Filename:="C:\test folder\book1.xls"
Workbooks.Open Filename:="C:\test folder\Book3.xls"
Windows("book1.xls").Activate
Range("F4").Select
Selection.Copy
Windows("Book3.xls").Activate
Range("A20").Select
ActiveSheet.Paste
End Sub
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi, wonder if someone can help.

I need to write information from various cells in one file (not in any
particular order) to another file.

The examples I have seen do not show quite what I want and when i try to
adapt them, it doesn't work.

I can open a file but writiig the information seems to be the problem.

Can you please help?

Thanks

Steve


Steve

Writing Cell info to a new Excel file
 
Thanks Gary, works a treat.

I don't supose there is anway you can write to a file without opening it is
there?

"Gary''s Student" wrote:

Say we have two existing files book1.xls and Book3.xls. We want to copy a
cell from someplace in book1 and paste it to somewhere in Book3. We open
both the source and destination book and do the copy/paste.

Sub Macro1()
ChDir "C:\test folder"
Workbooks.Open Filename:="C:\test folder\book1.xls"
Workbooks.Open Filename:="C:\test folder\Book3.xls"
Windows("book1.xls").Activate
Range("F4").Select
Selection.Copy
Windows("Book3.xls").Activate
Range("A20").Select
ActiveSheet.Paste
End Sub
--
Gary''s Student - gsnu200856


"Steve" wrote:

Hi, wonder if someone can help.

I need to write information from various cells in one file (not in any
particular order) to another file.

The examples I have seen do not show quite what I want and when i try to
adapt them, it doesn't work.

I can open a file but writiig the information seems to be the problem.

Can you please help?

Thanks

Steve



All times are GMT +1. The time now is 11:51 PM.

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