be formatted as text, otherwise m/nnn will be interepreted as _ a division of the number m by the number nnn — and that is not _ what is intended

Application.EnableEvents = False On Error GoTo ErrHandler resetFormatting aWS createOneDataBlock aWS cloneDataBlocks aWS addMSlash aWS

Application.EnableEvents = True Exit Sub ErrHandler:

MsgBox "Unexpected error in createWiringData:" & vbNewLine _

& "Error=" & Err.Description & " (" & Err.Number & ")" Application.EnableEvents = True End Sub

The one procedure from pass 1 that remains is the Workbook_SheetChange procedure. Excel calls this procedure whenever a cell value changes. If the value is different from the old value, you need to decide whether this is a new connection, a deletion of an existing connection, or a change to an existing connection.

To detect a new connection, you rely on the cell format. If it is that of an unused contact, you know this change establishes a new connection.

To detect a deletion, you rely on the cell being empty (the user has used either the Delete or Backspace key).

Anything else is a change in an existing connection.

Also, remember that if the client's action violates a wiring rule, you need to warn the client and restore the previous value.

Obviously, you need to store the previous value somewhere. The

Workbook_SheetSelectionChange procedure provides the perfect method. Excel runs that code whenever the user selects a cell. In it you can save the value of the cell.

0 0

Post a comment