Excel VBA

css navigation by Css3Menu.com

Write Contents of Multi Choice Box

You have filled a multi-select list box and your customers have figured out that they can select multiple items. Now how are you going to copy them to a spreadsheet.

My example may be a little hard to follow because I had to parse the data into 2 fields as it was written to cells.

For U = 0 To usrCreateNew.cmbTEaccts.ListCount - 1    'Items in Multi-select
    If usrCreateNew.cmbTEaccts.Selected(U) = True Then    'Items selected
       Cells(DaRow + G, 1) = _
       Right(usrCreateNew.cmbTEaccts.List(U), _      
                Len(usrCreateNew.cmbTEaccts.List(U)) - 7)       'Parse right section
      Cells(DaRow + G, 2) = _
             Left(usrCreateNew.cmbTEaccts.List(U), 6)         'Parse Left section
         For szCol = 33 To 77 Step 4	 'Cols 33,37,41, etc.
             Cells(DaRow + G, szCol) = 0            'Zero the columns
         Next szCol
         G = G + 1                                                   'Next row
    Else
    End If                
Next U

Play around with Multi-Select lists. They can be really useful.

© 2004-2024

Updated:  06/21/2024 07:42
This page added:  01 March 2004