ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there a bug in Excel 97/Office 97 running macros ? (https://www.excelbanter.com/excel-programming/289494-there-bug-excel-97-office-97-running-macros.html)

Rich J

Is there a bug in Excel 97/Office 97 running macros ?
 
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 textbo
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 1
These subroutines work perfectly in Office 2000 and later but randomly crash in Office 9

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 cel
CX (X
End Su
Sub CX(X
If Range("E" & X) = "" The
Range("E" & X) =
Range("F" & X) = "
Range("G" & X) = "
Range("D" & X) = "CLEAR
Els
Range("D" & X & ":G" & X) = "
End I

End Sub

Jim Cone

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




Rich J

Is there a bug in Excel 97/Office 97 running macros ?
 
Jim
Thanks so much. I've not used the Cells(R,C) type referencing before. That seems to have done the trick. I changed all the subroutines in that block of the code and the program works perfectly without any crashes.
I opened up one saved back in 2002 and it crashed the second I clicked one of the textboxes. I ran thru a bunch of testing on the new program and it never crashed.

Thanks again
Rich
Los Angeles


All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com