Results 1 to 3 of 3
  1. #1
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Get Value of BoundColumn (VBA/Excel/2002)

    I need to evaluate the first column of a ComboBox that was formed with 4 columns by filling an array and then applying the array to the ComboBox.

    <pre>Public myArray(5, 4) As String
    ~~~~~ bunch of code to generate
    Alan

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Get Value of BoundColumn (VBA/Excel/2002)

    BoundColumn is the number of the column that acts as bound column, not the value of that column. If you set BoundColumn to a value not equal to 0, the value of the combo box IS the value of the bound column.

    BTW, it's confusing to use the lst prefix for a combo box - lst is more commonly used for a list box.

  3. #3
    3 Star Lounger MacroAlan's Avatar
    Join Date
    Feb 2003
    Location
    St Louis, Missouri, USA
    Posts
    254
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: Get Value of BoundColumn (VBA/Excel/2002)

    The lst prefix was a holdover from a previous developer. I had a breakthru after I posted the inquiry but could not get back in the site:

    <pre>Private Sub cmdMorning_Click()
    On Error GoTo ErrHandler
    For i = 0 To lstReceipts.ListCount - 1
    Select Case lstReceipts.List(i, 0) <font color=red> 'Index of BoundColumn is Zero</font color=red>
    Case Is < 2000
    lstReceipts.Selected(i) = True <font color=red>' i is the ListIndex</font color=red>
    Case Else
    lstReceipts.Selected(i) = False
    End Select
    Next i
    Exit Sub
    ErrHandler:
    MsgBox "There are no reports from which to make a choice", vbInformation, "Error"
    End Sub</pre>


    Figuring this out, totally demystifies multi-column list boxes for me.
    Alan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •