View Single Post
  #3   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

On Dec 29, 2:17*am, The Code Cage Team <The.Code.Cage.Team.
wrote:
gtslabs;160877 Wrote:





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


How are you copying the sheet?, you could use the before right click
event on the worksheet and use the Application.enableevents=False...etc,
in the module you displayed you have them correctly positioned but
stetted out with the ' which just makes them comment lines!

--
The Code Cage Team

Regards,
The Code Cage Team
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
The Code Cage Team's Profile:http://www.thecodecage.com/forumz/member.php?userid=2
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=44724- Hide quoted text -

- Show quoted text -


We when I removed the comment lines I was not able to copy a sheet tab
to a new one.
I thought that code was the problem but I still get the errors.
The only way I can get it from not firing the 2 comboboxes is when I
am in the deisgn Mode.
Any ideas?