ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro question: how to copy information from another workbook. (https://www.excelbanter.com/excel-programming/276308-macro-question-how-copy-information-another-workbook.html)

Paul

Macro question: how to copy information from another workbook.
 
Hi

I need some help with a macro. By today it looks like

Sub Update_List
Workbooks.Open FileName:="c:\data\List.xls"
Sheets("ListNr1").Select
Cells.Celect
Selection.Copy
Windows("Paul.xls").Activate
Sheets("ListNr1").Select
Cells.Select
ActiveSheet.Paste
End Sub

I have made about 20 workbooks with 20 different names. Paul is one of
them, and the macro above is stored in that workbook. I need a macro
that always copy the information to the workbook where the macro is
started. Instead of the line

Windows("Paul.xls").Activate

I can use

ActiveWindows.ActivateNext

but this will cause problem if more than one workbook is active by the
time the macro is started.

I would appreciate if someone could help me with this.

Paul


All times are GMT +1. The time now is 05:36 AM.

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