MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Excel Crash on Mouse-Over of Object

November 14, 2001 - by Bill Jelen

Bill writes:

I have a document that has become very unstable. Every time that my mouse gets near one of the red comment triangles, Excel will crash.

After looking at Bill's worksheet, I found a somewhat innocuous macro that was causing the problem. In an effort to clear out some pictures and command buttons on the sheet, Bill had the following code:

For Each sh in ActiveSheet.Shapes
Next sh

I set up a new test workbook and was able to duplicate the problem. Apparently, the yellow box that pops up when you hover over a cell's red comment indicator is a Shape. I ran the above code, this time asking for a MsgBox sh.Name. Sure enough, included on among the pictures and buttons were one shape for each comment. Deleting this shape left the worksheet in a corrupt condition.

The workaround for this book was to remove the sheet and insert a new one without the broken comments. I also suggested changing the macro to this:

If Not Left(sh.Name, 7) = "Comment" Then sh.Delete

Bill Jelen is the author / co-author of
MrExcel LIVe

A book for people who use Excel 40+ hours per week. Illustrated in full color.