Force macro to run on a specific worksheet

D

Don

I have a timer scheduled via the ontime method every 5 minutes to run a
macro that I recorded.

The worksheet where I want the macro to run has links to another workbook
and when the timer pops the macro sometimes runs in the other workbook.

How can I ensure that the macro runs in the original workbook (and
worksheet)?

Here is a reference to the ontime method:
http://www.ozgrid.com/Excel/run-macro-on-time.htm

P.S. I am not very knowledgeable about VBA.
 
S

Shane Devenshire

Hi,

Show us you ontime procedure.

Sounds line you need something like this added to your code

wb=ActiveWorkbook.Name
Workbooks("myWB").Activate
....'your code here
Workbooks(wb).Activate
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top