Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
populating multicolumn listbox with an array instead of...
I know I am doing this wrong but it gets me close to what I want
because of the way I am dealing with records. I am inserting my previous post below. Any help please? How should this be different? --- This presents everything the way I want, filtering for the State I want in the form, and I can dump it to a textbox to edit but NOW I see that storing the edited version will pose problems. Basically I see that I went about this all wrong because I am lost when it comes to knowing how to do this with arrays. This code populates a listbox by first getting the variable it needs from a clickable map. Thanks to anyone who can help me understand. Scott ------ Private Sub UserForm_Initialize() Dim Contact As String Dim phone As String Dim str As String 'pull the State variable from another sub 'to build the listbox contents UserForm1.Caption = State ListBox1.ColumnCount = 4 'I want this to be a multicolumn listbox eventually On Error Resume Next EntryCount = 1 'to set the starting value For Each Cell In Sheets("Security").Range("e2:e2000") 'the State is stored in column E EntryCount = EntryCount + 1 'since the index starts at zero 'and we use the 1st row as a header Contact = Cell.Offset(0, -4) phone = Cell.Offset(0, 2) str = EntryCount & vbTab & State & vbTab & Contact & vbTab & phone If Cell = State Then ListBox1.AddItem (str) Else Next Cell EntryCount = 0 ListBox1.TextColumn = -1 CommandButton1.Caption = "Edit Selection" CommandButton2.Caption = "Remove Selection" End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Populating listbox with sheet names | Excel Discussion (Misc queries) | |||
Populating listbox | Excel Discussion (Misc queries) | |||
Populating multicolumn listbox the wrong way | Excel Programming | |||
multicolumn Listbox and textalignment | Excel Programming | |||
Values in a MultiColumn Listbox | Excel Programming |