Force macro to run on a specific worksheet

  • Thread starter Thread starter Don
  • Start date Start date
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.
 
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
 
Back
Top