View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bill Dika Bill Dika is offline
external usenet poster
 
Posts: 1
Default Macro won't execute when "For Each 'range' in 'range'" is added

Hi:

I am using XL 97 at work. On the weekend I did some work at home on
the file in XL 2000. When I came into work on Monday morning
everything worked fine in XL 97 except for the annoying message on
saving that "it was created in in a higher version and I could lose
some features by saving in XL 97". I get this message even after I
have saved the file in XL 97.

In any case, my more serious problem is as follows. In the VBE I have
the following code fragment:

Sub Etc()
Dim c as Range
'For Each c In Range ("AmortRng_Dates")
MsgBox "Got up to here."
....
'Next

If I run the macro as is the MsgBox pops up.
The problem is that if I uncomment the For Each ... Next construct the
macro doesn't run. No error messages. It simply does not run. The
MsgBox never pops up.

I have an addin that I created installed with some udf's. After
reading some posts here on udf problems stopping macro execution, I
entered On Error Resume Next in all my udf functions. The problem
still persists.

This problem seemed to start after I saved in XL 97, although I can't
be sure. In other words this code seemed to work when I first started
using it with XL 97 at work.

The same problem results when the VBE is closed and I run the macro
from the worksheet.

Could there be something wrong Tools-References?

Any help would be much appreciated.

Regards,
Bill Dika