ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving values from Multi-select List Box (https://www.excelbanter.com/excel-programming/439037-saving-values-multi-select-list-box.html)

Liz

Saving values from Multi-select List Box
 
Hi -
I have the following code that saves the values from a multi-select list box
across multiple cells. However, I would like to save the mulitple values to
one cell, using a comma or alt-enter delimiter instead. How can I modify
this code to save the selection of multiple values within one cell?

Dim DestCell As Range
Dim iCtr As Long

With Sheets("View My Requests")
Set DestCell = .Range("G" & inextrow)
End With

With Me.lstSecondProd
DestCell.Resize(.ListCount, 1).ClearContents

For iCtr = 0 To .ListCount - 1
If .Selected(iCtr) Then
DestCell.Value = .List(iCtr)
Set DestCell = DestCell.Offset(0, 1)
End If
Next iCtr
End With

In addition, I would like to also have the multi-select list box read the
multiple values from a cell (or read the values in a range) and use those
values as the default selections in the multi-select list box when the dialog
is shown. Is it possible to do this using a single cell? It is possible to
do this from a range of cells?

Thank you,
Liz


All times are GMT +1. The time now is 03:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com