View Full Version : Multiselect listbox saving selections


Kempes
07-07-2008, 12:08 AM
Hi all,

I have a listbox set to multiselect.

When users select one or more options and saves the spreadsheet, they are no longer selected when re-opening the spreadsheet.

How do I get excel to remember what options were chosen when saving and re-opening?

Many thanks
Kempes

Kempes
07-07-2008, 02:12 AM
sussed it,

For anyone else struggling with this issue....

I have this code in now that saves their selection to coumn P.

Dim i As Long
Dim v As Long

v = 0

For i = 0 To Me.listbox1.ListCount - 1
ThisWorkbook.Sheets(1).Range("P" & v + 1) = Me.listbox1.Selected(i)
v = v + 1
Next i

Then, in the workbook open event,

Dim i As Long
Dim v As Long

v = 0

For i = 0 To Me.listbox1.ListCount - 1
Me.listbox1.Selected(i) = ThisWorkbook.Sheets(1).Range("P" & v + 1)
v = v + 1
Next i