Returning From VBA Event Code Called From Excel 4.0 Macro

J

jj

I've developed a worksheet including some VBA code which is to be
added to dozens of workbooks, so that we can get the data in them into
a standardised format.

My worksheet includes some VBA code in the Worksheet_Calculate event,
and this has been causing conflicts when the workbook it's added to
already contains macros written in the Excel 4.0 XLM language.

If the XLM macro changes the workbook it triggers the
Worksheet_Calculate event, but this is then unable to hand control
back to the XLM macro which called it. The error message "No RETURN()
or HALT() function found on macro sheet" is displayed.

I've solved the problem by changing the old XLM macro so that the
first thing it does is to set workbook calculation to manual,
switching it back to automatic once it's made all its changes to the
workbook (A spot of error handling is needed here).

This works fine and everyone seems happy with the result, but is there
any way I can solve this problem by including some defensive VBA code
in the Worksheet_Calculate event itself?
 

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