Dave,
I have created a small workbook that contains one short macro that
crashes excel. It is repeatable, although excel doesn't crash in
exactly the same way every time. If you want to try it, here's what
to do.
Download
www.xlrotor.com/temp/book6.xls
When you open the file the active sheet will be Roots UCS
Press Alt-F8 and then Enter to run the macro named "aaa".
You won't see anything happen, but the macro rebuilds a bunch of cell
formulas on another sheet.
Then use your mouse to make a copy of the sheet Roots UCS.
Run the aaa macro again (sometimes 2 or 3 runs may be required), and
you'll get a run time error.
The r/t error is usually on either the clearcontents line or the
autofill line.
If you try to close the workbook and close Excel, excel will crash.
The sheet Roots UCS has nothing to do with the macro, and it contains
no cell formulas or any named ranges or any conditional formatting.
The macro is short and simple.
It runs fine before copying the sheet.
The macro code is shown below.
If you think I should repost this in a new thread focused on the crash
behavior, please let me know.
Cheers,
Brian
Sub aaa()
Dim nbm%
Dim stnum As Range, oda As Range, odb As Range, idb As Range
Dim geobeam_no As Range, geox As Range, geoa As Range, geob As
Range, geoam As Range, geobm As Range
Dim geospring_no As Range, geospring_x As Range, geospring_y As
Range
Dim a As Range, b As Range
10 nbm = Range("stnum").Count '\number of beams on the shaft input
sheet
'\get object pointers for the required ranges on the GeoPltData
sheet.
20 Set geobeam_no = Range("geobeam_no")
30 Set geox = Range("geox")
40 Set geoa = Range("geoa")
50 Set geoam = Range("geoam")
60 Set geospring_no = Range("geospring_no")
70 Set geospring_x = Range("geospring_x")
80 Set geospring_y = Range("geospring_y")
90 Set stnum = Range("stnum")
100 Set oda = Range("oda")
'\Clear out the ranges, except first beam.
110 Set a = geobeam_no(1)
120 Set b = geoam(geoam.Count)
130 Range(a, b).ClearContents
'\Rebuild the formulas
140 geobeam_no(1).Value = 1
150 geox(1).Formula = "=INDEX(sxl,INDEX(stnum,$A2))"
160 geox(2).Formula = "=B2"
170 geox(3).Formula = "=INDEX(sxl,INDEX(stnum,$A2)+1)"
180 geox(4).Formula = "=B4"
190 geox(5).Formula = "=B2"
200 geoa(1).Formula = "=INDEX(ida,$A2)"
210 geoa(2).Formula = "=INDEX(oda,$A2)"
220 geoa(3).Formula = "=C3"
230 geoa(4).Formula = "=C2"
240 geoa(5).Formula = "=C2"
250 geoam(1).Formula = "=-C2"
260 geoam(2).Formula = "=-C3"
270 geoam(3).Formula = "=-C4"
280 geoam(4).Formula = "=-C5"
290 geoam(5).Formula = "=-C6"
300 Set a = geobeam_no(1)
310 Set b = geoam(6)
320 If nbm >= 2 Then Range(a, b).AutoFill
Destination:=Range(geobeam_no(1), geoam(nbm * 6)), Type:=xlFillDefault
330 Range(geobeam_no(1), geoam(nbm * 6)).Calculate '\must
evaluate formulas after the autofill
End Sub