View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Juan Pablo González Juan Pablo González is offline
external usenet poster
 
Posts: 226
Default Runtime error only with Office 97 - advice required

Try setting the TakeFocusOnClick property of the button to False....

--
Regards

Juan Pablo González

"Kennyatwork" wrote in message
...
Hello

A file containing macros runs fine in Excel 2000 but I receive a run-time
error when the same code is run in Excel 97.

The run-time error is run-time error 13
Type mismatch

the line of code causing this is

If ActiveCell.Offset(0,14).Value<0 Then

could anyone advise me on how to make the code run under Excel 97

Regards
Kenny

Below is a larger chunk of the code

Private Sub CommandButton8_Click()

If LogEntry.TextBox2.Value = "" Then
MsgBox "There is nothing to sign off"

MyClearBoxes

Exit Sub
End If



If ActiveCell.Offset(0, 14).Value < 0 Then
MsgBox "This defect has already been signed off!"


MyClearBoxes

Sheets("Data").Range("A2").Activate
Exit Sub
End If

Select Case LogEntry.TextBox6.Value
Case "001": ActiveCell.Offset(0, 14).Value = "Kenny Wharton"
LogEntry.TextBox5.Value = Format(Now(), "D MMM YYYY HH:MM")
ActiveCell.Offset(0, 12).Value = LogEntry.TextBox5.Value
ActiveCell.Offset(0, 11).Value = LogEntry.TextBox4.Value


MyClearBoxes


Case "002": ActiveCell.Offset(0, 14).Value = "Karl Eason"
LogEntry.TextBox5.Value = Format(Now(), "D MMM YYYY HH:MM")
ActiveCell.Offset(0, 12).Value = LogEntry.TextBox5.Value
ActiveCell.Offset(0, 11).Value = LogEntry.TextBox4.Value

MyClearBoxes


Case "003": ActiveCell.Offset(0, 14).Value = "Len Stobbs"
LogEntry.TextBox5.Value = Format(Now(), "D MMM YYYY HH:MM")
ActiveCell.Offset(0, 12).Value = LogEntry.TextBox5.Value
ActiveCell.Offset(0, 11).Value = LogEntry.TextBox4.Value

MyClearBoxes


Case Else:

MsgBox "Password failed - Unable to show as RECTIFIED"
ActiveCell.Offset(0, 14).Value = ""
ActiveCell.Offset(0, 12).Value = ""
ActiveCell.Offset(0, 11).Value = ""

response = MsgBox("Do you want to enter another record?", vbYesNo)
If response = vbYes Then

MyClearBoxes

Else
Unload LogEntry
ThisWorkbook.Save
Application.Quit

End If
End Select


End Sub