Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default preventing comboboxes from triggering when sheet copied


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...ad.php?t=44724

  #3   Report Post  
Posted to microsoft.public.excel.programming
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?
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping through different comboboxes in an excel sheet [email protected] Excel Programming 2 September 20th 07 09:20 PM
Triggering an event whenever a new shape is added in a sheet Sagittarian Excel Programming 1 June 21st 07 12:59 AM
Preventing incorrect data from being copied TimN Excel Programming 8 August 2nd 06 11:05 PM
Fire events for all comboboxes in my sheet Ardus Petus Excel Programming 2 June 9th 06 12:24 PM
Preventing a workbook from being copied CiaraG[_4_] Excel Programming 1 March 4th 04 01:24 PM


All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"