Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MVM MVM is offline
external usenet poster
 
Posts: 53
Default Application.enable

When I change a value in a combobox, say 16th combobox
why is that 15 and then 14 code also run at the end of 16.
This is written in excel 2003 vba.

why applications.enableevents = false is not working

Any help is greatly appreciated.
MVM

---------------------------- code -------------
Private Sub cmbGrade14_Change()
Call blockDataEntry(cmbGrade14, 14)
End Sub
Private Sub cmbGrade15_Change()
Call blockDataEntry(cmbGrade15, 15)
End Sub
Private Sub cmbGrade16_Change()
Call blockDataEntry(cmbGrade16, 16)
End Sub

public sub blockDataEntry(c as combobox, r as integer)
Application.enableEvents = False
........
Application.enableEvents = true
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application.enable

The enableevents setting is an setting in the Excel object library. Object
in the control toolbox toolbar are in the MS forms 2.0 library, so they have
no knowledge of nor are they governed by the EnableEvents setting. Only
Excel proper events adhere to this.

You will need to use a public boolean variable to allow events to terminate
upon entry when it is set. Therefore you code needs to set the variable to
true (a variable like

Public bBlockEvents as Boolean

Private Sub cmbGrade14_Change()
if bBlockEvents then exit sub
bBlockEvents = True
Call blockDataEntry(cmbGrade14, 14)
bBlockEvents = False
End Sub

as an example or perhaps you can do the setting and unsetting in
blockDataEntry.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
When I change a value in a combobox, say 16th combobox
why is that 15 and then 14 code also run at the end of 16.
This is written in excel 2003 vba.

why applications.enableevents = false is not working

Any help is greatly appreciated.
MVM

---------------------------- code -------------
Private Sub cmbGrade14_Change()
Call blockDataEntry(cmbGrade14, 14)
End Sub
Private Sub cmbGrade15_Change()
Call blockDataEntry(cmbGrade15, 15)
End Sub
Private Sub cmbGrade16_Change()
Call blockDataEntry(cmbGrade16, 16)
End Sub

public sub blockDataEntry(c as combobox, r as integer)
Application.enableEvents = False
.......
Application.enableEvents = true
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
MVM MVM is offline
external usenet poster
 
Posts: 53
Default Application.enable

Tom
Thank you for the suggestion and educating me.
When I put these comboboxes, i copied and pasted. Is this creating an array
of controls and looping through all of them, even though there is no reason
to trigger them. If so, is there any simple way to make these controls
independent, i mean not arrayed.

Thanks
MVM

"Tom Ogilvy" wrote:

The enableevents setting is an setting in the Excel object library. Object
in the control toolbox toolbar are in the MS forms 2.0 library, so they have
no knowledge of nor are they governed by the EnableEvents setting. Only
Excel proper events adhere to this.

You will need to use a public boolean variable to allow events to terminate
upon entry when it is set. Therefore you code needs to set the variable to
true (a variable like

Public bBlockEvents as Boolean

Private Sub cmbGrade14_Change()
if bBlockEvents then exit sub
bBlockEvents = True
Call blockDataEntry(cmbGrade14, 14)
bBlockEvents = False
End Sub

as an example or perhaps you can do the setting and unsetting in
blockDataEntry.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
When I change a value in a combobox, say 16th combobox
why is that 15 and then 14 code also run at the end of 16.
This is written in excel 2003 vba.

why applications.enableevents = false is not working

Any help is greatly appreciated.
MVM

---------------------------- code -------------
Private Sub cmbGrade14_Change()
Call blockDataEntry(cmbGrade14, 14)
End Sub
Private Sub cmbGrade15_Change()
Call blockDataEntry(cmbGrade15, 15)
End Sub
Private Sub cmbGrade16_Change()
Call blockDataEntry(cmbGrade16, 16)
End Sub

public sub blockDataEntry(c as combobox, r as integer)
Application.enableEvents = False
.......
Application.enableEvents = true
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application.enable

No, there is no built in array of controls and copying does not create an
array of controls. Once copied, the control is independent of the original
as long as you change any linked cells. If you had linked cells before the
copy and didn't change them, then this could be the source of your pain.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
Tom
Thank you for the suggestion and educating me.
When I put these comboboxes, i copied and pasted. Is this creating an

array
of controls and looping through all of them, even though there is no

reason
to trigger them. If so, is there any simple way to make these controls
independent, i mean not arrayed.

Thanks
MVM

"Tom Ogilvy" wrote:

The enableevents setting is an setting in the Excel object library.

Object
in the control toolbox toolbar are in the MS forms 2.0 library, so they

have
no knowledge of nor are they governed by the EnableEvents setting. Only
Excel proper events adhere to this.

You will need to use a public boolean variable to allow events to

terminate
upon entry when it is set. Therefore you code needs to set the variable

to
true (a variable like

Public bBlockEvents as Boolean

Private Sub cmbGrade14_Change()
if bBlockEvents then exit sub
bBlockEvents = True
Call blockDataEntry(cmbGrade14, 14)
bBlockEvents = False
End Sub

as an example or perhaps you can do the setting and unsetting in
blockDataEntry.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
When I change a value in a combobox, say 16th combobox
why is that 15 and then 14 code also run at the end of 16.
This is written in excel 2003 vba.

why applications.enableevents = false is not working

Any help is greatly appreciated.
MVM

---------------------------- code -------------
Private Sub cmbGrade14_Change()
Call blockDataEntry(cmbGrade14, 14)
End Sub
Private Sub cmbGrade15_Change()
Call blockDataEntry(cmbGrade15, 15)
End Sub
Private Sub cmbGrade16_Change()
Call blockDataEntry(cmbGrade16, 16)
End Sub

public sub blockDataEntry(c as combobox, r as integer)
Application.enableEvents = False
.......
Application.enableEvents = true
End Sub






  #5   Report Post  
Posted to microsoft.public.excel.programming
MVM MVM is offline
external usenet poster
 
Posts: 53
Default Application.enable

I am still having problem.
No, I did not link the cells with the control combobox.

under
commandbutton_click event ihave the following lines

With mySh
Application.EnableEvents = False
Range(.Cells(5, 10), .Cells(5, 17)).Clear
Range(.Cells(51, 3), .Cells(51, 10)).Clear
.....
each of these range.clear statements trigger all combobox_change events one
by one. These cells have no relation with any of the combos.

could you educate or guide me to understnd this.
thanks

MVM

"Tom Ogilvy" wrote:

No, there is no built in array of controls and copying does not create an
array of controls. Once copied, the control is independent of the original
as long as you change any linked cells. If you had linked cells before the
copy and didn't change them, then this could be the source of your pain.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
Tom
Thank you for the suggestion and educating me.
When I put these comboboxes, i copied and pasted. Is this creating an

array
of controls and looping through all of them, even though there is no

reason
to trigger them. If so, is there any simple way to make these controls
independent, i mean not arrayed.

Thanks
MVM

"Tom Ogilvy" wrote:

The enableevents setting is an setting in the Excel object library.

Object
in the control toolbox toolbar are in the MS forms 2.0 library, so they

have
no knowledge of nor are they governed by the EnableEvents setting. Only
Excel proper events adhere to this.

You will need to use a public boolean variable to allow events to

terminate
upon entry when it is set. Therefore you code needs to set the variable

to
true (a variable like

Public bBlockEvents as Boolean

Private Sub cmbGrade14_Change()
if bBlockEvents then exit sub
bBlockEvents = True
Call blockDataEntry(cmbGrade14, 14)
bBlockEvents = False
End Sub

as an example or perhaps you can do the setting and unsetting in
blockDataEntry.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
When I change a value in a combobox, say 16th combobox
why is that 15 and then 14 code also run at the end of 16.
This is written in excel 2003 vba.

why applications.enableevents = false is not working

Any help is greatly appreciated.
MVM

---------------------------- code -------------
Private Sub cmbGrade14_Change()
Call blockDataEntry(cmbGrade14, 14)
End Sub
Private Sub cmbGrade15_Change()
Call blockDataEntry(cmbGrade15, 15)
End Sub
Private Sub cmbGrade16_Change()
Call blockDataEntry(cmbGrade16, 16)
End Sub

public sub blockDataEntry(c as combobox, r as integer)
Application.enableEvents = False
.......
Application.enableEvents = true
End Sub








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Application.enable

You say you have no links and the cells have no relation to the comboboxes.

I have never experienced this and it certainly isn't predictable.

I can only assume that somewhere there is a link or a relationship.

--
Regards,
Tom Ogilvy


"MVM" wrote in message
...
I am still having problem.
No, I did not link the cells with the control combobox.

under
commandbutton_click event ihave the following lines

With mySh
Application.EnableEvents = False
Range(.Cells(5, 10), .Cells(5, 17)).Clear
Range(.Cells(51, 3), .Cells(51, 10)).Clear
....
each of these range.clear statements trigger all combobox_change events

one
by one. These cells have no relation with any of the combos.

could you educate or guide me to understnd this.
thanks

MVM

"Tom Ogilvy" wrote:

No, there is no built in array of controls and copying does not create

an
array of controls. Once copied, the control is independent of the

original
as long as you change any linked cells. If you had linked cells before

the
copy and didn't change them, then this could be the source of your pain.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
Tom
Thank you for the suggestion and educating me.
When I put these comboboxes, i copied and pasted. Is this creating an

array
of controls and looping through all of them, even though there is no

reason
to trigger them. If so, is there any simple way to make these

controls
independent, i mean not arrayed.

Thanks
MVM

"Tom Ogilvy" wrote:

The enableevents setting is an setting in the Excel object library.

Object
in the control toolbox toolbar are in the MS forms 2.0 library, so

they
have
no knowledge of nor are they governed by the EnableEvents setting.

Only
Excel proper events adhere to this.

You will need to use a public boolean variable to allow events to

terminate
upon entry when it is set. Therefore you code needs to set the

variable
to
true (a variable like

Public bBlockEvents as Boolean

Private Sub cmbGrade14_Change()
if bBlockEvents then exit sub
bBlockEvents = True
Call blockDataEntry(cmbGrade14, 14)
bBlockEvents = False
End Sub

as an example or perhaps you can do the setting and unsetting in
blockDataEntry.

--
Regards,
Tom Ogilvy



"MVM" wrote in message
...
When I change a value in a combobox, say 16th combobox
why is that 15 and then 14 code also run at the end of 16.
This is written in excel 2003 vba.

why applications.enableevents = false is not working

Any help is greatly appreciated.
MVM

---------------------------- code -------------
Private Sub cmbGrade14_Change()
Call blockDataEntry(cmbGrade14, 14)
End Sub
Private Sub cmbGrade15_Change()
Call blockDataEntry(cmbGrade15, 15)
End Sub
Private Sub cmbGrade16_Change()
Call blockDataEntry(cmbGrade16, 16)
End Sub

public sub blockDataEntry(c as combobox, r as integer)
Application.enableEvents = False
.......
Application.enableEvents = true
End Sub








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
HOW TO DO ENABLE ENABLE THE QUERY PARAMETER BUTTON? CPW Excel Worksheet Functions 1 January 21st 10 06:31 PM
Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen) Paul Martin Excel Programming 5 August 5th 05 04:44 PM
Replace application.RTD property by Application.RTDServers collect John.Greenan Excel Programming 1 July 7th 05 02:05 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
application.quit will not shut off application john Excel Programming 0 January 9th 04 11:29 PM


All times are GMT +1. The time now is 08:14 PM.

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

About Us

"It's about Microsoft Excel"