PDA

View Full Version : Form, listbox and multilines problem



benjansen
07-01-2008, 11:59 PM
Dear all,

I have the following problem. I created a form in Excel with a listbox, multiline select. When opening the form this executes a loop for writing the selected entries of the listbox to a range of cells in sheet 1

Dim lItem As Long
For lItem = 0 To lsboxMainframe.ListCount - 1
If lsboxMainframe.Selected(lItem) = True Then
Sheet1.Range("B60").End(xlUp)(2, 1) = lsboxMainframe.List(lItem)
lsboxMainframe.Selected(lItem) = False
End If

The problem:
When I open the document it should show the selected items of the listbox......so it should read the written items in the cells....

Well....how the h*ll should I do this.....I haven't got any clue....I did this for a textbox...but this is simple....on opening the form...

Worksheets("Detailsheet").Range("E15") = DRPC.txtNamebsd.Value
Can anyone help me out here....??????

Thanx for the effort
Ben

JimmyTheHand
07-02-2008, 12:14 AM
It's not clear what you want.
You say that, upon opening the form, a code runs that writes the selected elements of a listbox to a series of cells. Upon opening the form, the listbox should be empty, i.e. no elements selected. So what is this code about?

Now, let's say the selected items are written to the series of cells. (I assume they are saved before closing the document.) And upon re-opening the document you want the data to be shown... but they are there in the cells... so what should be shown and where?

If you could upload a sample workbook, that would make this a lot easier to grasp.

Jimmy