B
Bob Walsh
I'm working with Office Web Components (9.0-2000)'s spreadsheet
control in VB6 and have hit a snag. I want to wheever the user enters
a value in column x to multiply that value times another value in the
same row and enter a new value in a different column, same row. Every
time this code runs, vb6 crashes.
the code is:
Private Sub spread_EndEdit(ByVal EventInfo As
OWC.SpreadsheetEventInfo)
Dim rng As Range
Dim rngQty As Range
Dim rngResult As Range
Dim testVal As Variant
' If stopRecurse = False Then
spread.EnableEvents = False
stopRecurse = True
testVal = EventInfo.EditData
Set rng = EventInfo.Range
Select Case EventInfo.Range.Column
Case 1 ' est. note.
Case 5 ' quantity
If IsNumeric(testVal) = False Then
MsgBox "Enter only values (5, 100, 1000, etc.) in the
Quantity column.", _
vbInformation, appTitle
EventInfo.ReturnValue = False
End If
Case 7 'sub unit rate
Set rngQty = rng.Offset(0, -2)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * CSng(testVal)
End If
Case 9 'equip unit rate
Set rngQty = rng.Offset(0, -4)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * rng.Value
End If
Case 11 'mat unit rate
Set rngQty = rng.Offset(0, -6)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * rng.Value
End If
Case 13 'prod. rate
Set rngQty = rng.Offset(0, -8)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * rng.Value
End If
Case 15 'cost/hr rate
End Select
'End If
stopRecurse = False
spread.EnableAutoCalculate = True
spread.EnableEvents = True
End Sub
Anyone know a solution?
control in VB6 and have hit a snag. I want to wheever the user enters
a value in column x to multiply that value times another value in the
same row and enter a new value in a different column, same row. Every
time this code runs, vb6 crashes.
the code is:
Private Sub spread_EndEdit(ByVal EventInfo As
OWC.SpreadsheetEventInfo)
Dim rng As Range
Dim rngQty As Range
Dim rngResult As Range
Dim testVal As Variant
' If stopRecurse = False Then
spread.EnableEvents = False
stopRecurse = True
testVal = EventInfo.EditData
Set rng = EventInfo.Range
Select Case EventInfo.Range.Column
Case 1 ' est. note.
Case 5 ' quantity
If IsNumeric(testVal) = False Then
MsgBox "Enter only values (5, 100, 1000, etc.) in the
Quantity column.", _
vbInformation, appTitle
EventInfo.ReturnValue = False
End If
Case 7 'sub unit rate
Set rngQty = rng.Offset(0, -2)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * CSng(testVal)
End If
Case 9 'equip unit rate
Set rngQty = rng.Offset(0, -4)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * rng.Value
End If
Case 11 'mat unit rate
Set rngQty = rng.Offset(0, -6)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * rng.Value
End If
Case 13 'prod. rate
Set rngQty = rng.Offset(0, -8)
If rngQty.Value > 0 Then
Set rngResult = rng.Offset(0, 1)
rngResult.Value = rngQty.Value * rng.Value
End If
Case 15 'cost/hr rate
End Select
'End If
stopRecurse = False
spread.EnableAutoCalculate = True
spread.EnableEvents = True
End Sub
Anyone know a solution?