View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Disable Combo Box On_Change Macro

As I illustrated, the name is a special name only associated with telling
the "on_change" routine if it should immediately exit or continue on.

Customview seems to have something to do with your data, so you shouldn't
use it. Use a dedicated name as I illustrated. Make it a book level name

Activeworkbook.Names.Add:="cboList", RefersTo:="=False"



ActiveWorkbook.Names("cboList").RefersTo:="=True"

in the Event code

Private Sub cboList_Change()
if Not [cboList] then exit sub


another approach might be to use the click event rather than the change
event. This might not fire if you change the listfillrange.

Or you could try changing the listfillrange but I believe this would fire
the event.


--
Regards,
Tom Ogilvy


"Randy Eastland" wrote in message
...
Thanks, Tom. I appreciate your help.

I'm having problems applying your suggestion. When I get to the line of
code that I think sets the flag to false, I get an "Application defined
or object defined error". Here is my code in the addin file:

Sub UpdateViewList()

Application.EnableEvents = False

'First, select the set of custom view names in row one
Worksheets("Settings").Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy

'Line inserted per advice of Tom Ogilvy
ActiveSheet.Names("CustomViewList").RefersTo = "=False"

'Paste this list (transposed) so that the list box can pull from it
Application.Goto Reference:="TopViewList"
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone,
SkipBlanks:=False _
, Transpose:=True

'Update the named range "CustomViewList" so that the drop down list
pulls the correct values
Selection.CurrentRegion.Name = "CustomViewList"

Application.EnableEvents = True
ActiveSheet.Names("CustomViewList").RefersTo = "=True"

End Sub


The range name is called "CustomViewList". Did I apply this correctly?
It would seem not. It is on the paste special line that the on_change
event is activated. That is what I am trying to suppress.

Thanks again, Tom. Your help is appreciated.
Randy Eastland


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!