Download presentation
Presentation is loading. Please wait.
Published byKevin Franklin Modified over 9 years ago
1
Indexing
2
The Idea of Indexing Indexing means having several data items organized under a single name where the individual items can be referred to by number It’s like having an address where you need a house number as well as a street name Indexing is extremely useful for cycling through a group of items using a loop We’ve already seen this used in strings
3
String Structure A string in VBA can be variable length and has an internal structure Each character in the string has a position number, called an index The first character has index 1, etc. So the string “This is a string.” has 17 characters, counting the blanks: Thisisastring. 1234567891011121314151617
4
Indexing in Listboxes We’ve been using listboxes as a place to print information on a user form But they can also be used in a much more flexible way to store and access information The workbook called IndexListBox has examples of how to use these features One important fact: indexing in a listbox starts at 0 instead of 1
5
Some Useful Properties lstName.Listcount is the number of items in list box lstName lstName(anIndex) is the item in the listbox lstName with index anIndex lstName.ListIndex is the index of the selected item in the listbox
6
Demo: Index ListBox
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.