Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Read Dropdown list from Excel column

Oops.., typo!

Ah, I see now what the issue is. Look in the Object Browser under
Range().Validation to see the properties/method available. Press F1 for
further info/examples to see what you need to grab from for your list. For
example, if the list is hard-entered items then...

oSheet.Range("A1").Validation.Formula1

..returns the list as entered. So if the list is '1,2,3,4,5' then it might be
auto-typed as a string "1,2,3,4,5" when put into a variable.

If it holds a ref to a range where the list is stored then it will return the
range address prepended with an equal symbol...

=$F$1:$J$1

..that you can parse however you want to get the list items however you want.

If it holds a ref to a defined name where the list is stored then it gets a
bit more complex depending on whether the defined name refs a range or just
stores the list. Either must be queried via the Application.Evaluate method
to returns the value in its 'RefersTo' property. This will be a range ref or
the list items and so your code will need to parse accordingly.

In summary, you need to evaluate whether Formula1 contains a range address or
defined name. If the latter you need to evaluate whether the defined name is
local (sheet level) or global (workbook level) in scope. (God forbid it's
defined both ways, but if so I believe the local scope name has precedence
over global!!) Then you need to determine if the defined name refs a range or
holds a delimited string.

Note that there is only 1 method for Range().Validation, which is 'Modify'!


--
Garry

Free uenet access at http://www.eternal-september.org
Classic VB Users Regroup
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


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 read the contents of an OLEObject (dropdown list) in excel FurRelKT Excel Programming 0 August 3rd 10 06:01 PM
Creating a dropdown list within a column dsebiz Excel Discussion (Misc queries) 4 March 19th 08 05:56 PM
Dropdown List that populates another column HAZBONES Excel Worksheet Functions 7 December 1st 07 03:10 AM
Dropdown List - list item endings not visible if column too narrow AK9955 Excel Discussion (Misc queries) 2 April 27th 07 09:02 AM
Procedure to make a dropdown list larger so it's easier to read Jack Oziel Excel Discussion (Misc queries) 4 December 26th 05 05:49 PM


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

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"