No, you are correct. It needs to be defined before any code is run since
the user may be making selections from the combobox before the Addin does
its work. I just chose to use the ADD method in the second email just for
variety.
--
Regards,
Tom Ogilvy
"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Or, of course, set it in code as Tom illustrated.
--
Vasant
"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
I think Tom may have left out a step. You will need to initially set the
defined name cboFlag:
Insert | Name | Define | Names in Workbook: cboFlag | Refers To: =FALSE
|
OK
And use that name in the code rather than "CustomViewList".
--
Vasant
ActiveWorkbook.Names.Add "cboFlag", "=False"
"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!