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 Is there a bug in Excel 97/Office 97 running macros ?

Rich,

Yes, your posted code crashed my XL97 application after about 2 clicks on the
textbox.
The following version did not crash (so far)...
'-----------------------------------------------------------
Sub ClickNumber16()
Dim X As Long
X = 16
CallTheSub X
End Sub

Sub CallTheSub(ByRef X As Long)
If Cells(X, 5).Value = vbNullString Then
Cells(X, 4).Value = "CLEAR"
Cells(X, 5).Value = 1
Cells(X, 6).Value = vbNullString
Else
Cells(X, 4).Value = vbNullString
End If
Cells(X, 7).Value = vbNullString
End Sub
'----------------------------------------------------------------

Regards,
Jim Cone
San Francisco, Ca

"Rich J" wrote in message
...
I created a complicated spreadsheet with about 40 text boxes that have macros

attached to them. I wrote one version in 2000 and converted it back to Excel
97. The macros crash Excel 97 when clicked.
I completely re-wrote the program on a computer with Excel 97 and it does the

same thing.

Is there something wrong with my code or is there a bug in Excel 97 with

textboxes and attaching macros ?
It is random and doesn't behave the same every time.
Both programs work perfectly on a computer with Office/Excel 2000.

This is one subroutine that is attached to a textbox
Each click of the textbox results in the value of the cell below it

alternating between 1 and 0
and then blanks all adjacent cells if 0 or if 1 it adds CLEAR to column 'D',

row 16 and 1 to column 'E', row 16
These subroutines work perfectly in Office 2000 and later but randomly crash

in Office 97

Sub Text16C() <--- attached to a textbox on

spreadsheet. The textbox is transparent and the cell
X = 16 below it is what is

seen. The user clicks on the textbox to enter a 1 in the cell
CX (X)
End Sub
Sub CX(X)
If Range("E" & X) = "" Then
Range("E" & X) = 1
Range("F" & X) = ""
Range("G" & X) = ""
Range("D" & X) = "CLEAR"
Else
Range("D" & X & ":G" & X) = ""
End If

End Sub