ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Open a file with a macro (https://www.excelbanter.com/excel-programming/332626-open-file-macro.html)

Vanity

Open a file with a macro
 

Hi,

I wonder if it's possible to create a macro that can open a file?
I need a macro-solution for this problem:
For example, if I change something in file1 and then run my macro and
it will open file2 and copy some cells from file1 to file2 and then
close file2 again.
Can someone help me, please?

//Vanity


--
Vanity
------------------------------------------------------------------------
Vanity's Profile: http://www.excelforum.com/member.php...o&userid=24568
View this thread: http://www.excelforum.com/showthread...hreadid=381561


Bob Phillips[_7_]

Open a file with a macro
 
Set oThis = ActiveWorkbook
Workbooks.Open Filename:="Example.xls"
oThis.Worksheets("Sheet1").Range("A1:H10").Copy ActiveSheet.Range("A1")
ActiveWorkbook.Close

--
HTH

Bob Phillips

"Vanity" wrote in
message ...

Hi,

I wonder if it's possible to create a macro that can open a file?
I need a macro-solution for this problem:
For example, if I change something in file1 and then run my macro and
it will open file2 and copy some cells from file1 to file2 and then
close file2 again.
Can someone help me, please?

//Vanity


--
Vanity
------------------------------------------------------------------------
Vanity's Profile:

http://www.excelforum.com/member.php...o&userid=24568
View this thread: http://www.excelforum.com/showthread...hreadid=381561





All times are GMT +1. The time now is 05:34 PM.

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