The event procedure in this example runs whenever the user types data in a spreadsheet cell. If the data is anything other than an integer between 1 and 6, the procedure displays a message box and cancels the entry. Note that this procedure is declared as required by Visual Basic. For more information about using event procedures, see Declaring and Using Event Procedures.
Private Sub Spreadsheet1_EndEdit(ByVal EventInfo As OWC.SpreadsheetEventInfo)
Select Case EventInfo.EditData
Case "1", "2", "3", "4", "5", "6"
Case Else
MsgBox "Please enter an integer between 1 and 6 inclusive."
EventInfo.ReturnValue = False
End Select
End Sub