Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Robert Crandal has brought this to us :
Sure, I probably wasnt very clear, so I'll try to just give the basic gist of what I need. I was basically wondering if Visual Basic for Excel 2007 has some sort of data type that can hold a "set" of unique strings. I would like to be able to add or remove strings from this set and possibly iterate through the set of strings to see what the set contains. I realize that I could use an array of strings to implement a set of of strings, but that seems to be overkill and possibly time consuming. So, I'm basically wondering if Visual Basic provides some sort of a "set" data type or datastructure?? Does that make sense? Robert Hi Robert, That's a bit more helpful but doesn't answer my Q about a 'linked list'. There is no data type that holds a 'set' of values as you describe. There are structures you could use to store and manipulate sets of data; namely an Array() or a Collection would be first chioces for unknown values/size at runtime. Both of these would let you add/remove/change the data however required. In both cases, you might want to store the data in a file (possibly encrypted) so it can be retrieved at startup and saved at shutdown. The UDT structure might work for known members at design time but you can only change the values at runtime (ergo you can't add/remove members at runtime). The easiest approach <IMO would be to use a variable defined as Variant data type. This would allow you to manipulate the data using VB[A]'s Split() and Join() functions as well as the Filter() function to remove blank elements resulting from deleted data. I'd use a delimited string for each record of data so it fits nicely into a one dim array. Parsing each record is fairly easy and straight forward using the Split() function. Optionally, depending on how the storage is structured, you could use ADO to manage the data in 'sets' based on criteria you define. HTH -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Use VBA to reset data validation (=list) value to first value in that list (list is a named range) | Excel Programming | |||
data validation list: how do i 'force' a user to enter data from the list? | Excel Discussion (Misc queries) | |||
data validation list: how do i 'force' a user to enter data from the list? | Excel Discussion (Misc queries) | |||
How to view a list of data based on another list of data | Excel Discussion (Misc queries) | |||
converting vertical data list to horizontal data list | Excel Worksheet Functions |