View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Macro runs in another workbook if you open simultaneously


Qualify All workbook, worksheet and range callouts.
For example...
ThisWorkbook.Worksheets("Monitor").UsedRange
Also, the code should be in standard module not a sheet module.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Priyanka"

wrote in message
Hi
I have a macro 'Adder' that is scheduled to run every fifteen minutes
on a particular workbook which contains a worksheet called 'Monitor'.
However, if another workbook is opened while this macro is running,
the macro tries to find the sheet Monitor in the other open workbook
and returns a 'subscript out of range error'. How do I prevent this?
Please help. The code is pasted below. Thanks a bunch in advance
Priyanka
-snip-