Macro run while working on another excel file

shortymcshort

New Member
Joined
May 26, 2006
Messages
15
Sub Worksheet_Calculate()
If Range("Ak6").value = 2 Or Range("ak6").value = 20 Then
Application.Run "Enter"
End If
End Sub

I have this workshet_calcualte() macro that I am using and it works fine as long as I have this workbook open. I can minimize it and work on other stuff and this macro will still kick butt. But whenever I am in another completely excel file this macro won't work. I assume that is because it can't find the sheet that it is supposed to work in.

My question is: Is it possible to have this macro run while I am working in another excel file. Version 2003 The name of the file with the macro in it is called "twsdde.xls".

Everytime I put in object.GetFile(C:\Jts\Excel\TwsDde.xls) it immediately pops up a complie error syntax error and I can't figure out what it is. I am putting it above the if statement.

thanks
Eric
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Just to answer my own question in case someone else can decipher what I am asking. All I did was put this at the top of my macro:

Workbooks("Book3.xls").Activate

Where book3.xls is the name of the file and it must be open in order for it to work.

Eric
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,952
Members
448,535
Latest member
alrossman

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