Running a Macro in 1st workbook, when a specific second workbook opens

rossmcn1

New Member
Joined
Feb 22, 2011
Messages
3
Hi,

I was wondering whether you can run a macro in workbook 1 upon the event of another workbook (2) opening.

For example I click a button to open a webpage withing Workbook 1, I manually manipulate which data on the webpage I want to download, and upon the download it always opens a .CSV file with the same workbook name every time.

What I want to happen is upon the Workbook2.csv file opening (after the download), is to automatically run code that copies the data from the .CSV file into Workbook 1.

Is it possible?

If you need the actual code I can add it, but for simplicity I'll leave it as a question for now.

Cheers in advance for the help you can give

Ross
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
You can run a macro from one workbook on another, especially if you know the name of the other one.

You can actually use the Macro Recorder to get most of the code you need. Just record yourself doing the steps manually, and then view your code, i.e.

Code:
    Windows("WorkBook2.csv").Activate
    Range("A1:A5").Copy
    Windows("WorkBook1.xlsm").Activate
    ActiveSheet.Paste
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top