View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gtslabs gtslabs is offline
external usenet poster
 
Posts: 54
Default preventing comboboxes from triggering when sheet copied

I have 2 comboboxes that are triggering when ever I copy the sheet to
a new sheet or delete a sheet. This is generating errors. I also
have a workshet_selectionCange and have isolated that this is
triggering the 2 combo routines even though the combos are based on a
Click event.
The linked cell and reference range of the 2 comboboxes do not refer
to the cells in the module below. The combobox code is in each sheet
not a module.

How can I modify my code to prevent the combos from triggering when a
new sheet is added, deleted, etc.


in the worksheet:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
jfactor
End Sub



in a module:
Sub jfactor()
'Application.EnableEvents = False
If Cells(27, 2).Value = 0 Then
Cells(28, 2).Value = ""
ElseIf Cells(28, 2) = "" Then '<==== ADD THIS CODE
Cells(28, 2).Value = 1000 'whatever the default value is
End If
' Application.EnableEvents = True
End Sub