Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
User form question
I have an user form with a list box on it. The source of the list box is a
range of cells on sheet1 (A1:A30), the cells contain quite long sentences. What I would like to do, if possible, is to be able to click an item in the list, then click the OK button and the text selected would be put into the active cell on the activesheet. Any help gratefully received. Gareth |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
User form question
You can use this event in the userform module
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean) ActiveCell.Value = Me.ListBox1.Value End Sub If you DblClick the value will be in the active cell Or the single click event Private Sub ListBox1_Click() ' your code End Sub -- Regards Ron de Bruin (Win XP Pro SP-1 XL2002 SP-2) www.rondebruin.nl "Gareth" wrote in message ... I have an user form with a list box on it. The source of the list box is a range of cells on sheet1 (A1:A30), the cells contain quite long sentences. What I would like to do, if possible, is to be able to click an item in the list, then click the OK button and the text selected would be put into the active cell on the activesheet. Any help gratefully received. Gareth |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
User form question
Gareth,
Use the following code in your form's code module. Change "ListBox1" to the name of your list box and "CommandButton2" to the name of your OK button. Private Sub CommandButton2_Click() With Me.ListBox1 If .ListIndex = 0 Then ActiveCell.Value = .List(.ListIndex) End If End With End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Gareth" wrote in message ... I have an user form with a list box on it. The source of the list box is a range of cells on sheet1 (A1:A30), the cells contain quite long sentences. What I would like to do, if possible, is to be able to click an item in the list, then click the OK button and the text selected would be put into the active cell on the activesheet. Any help gratefully received. Gareth |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
User Form question | Excel Discussion (Misc queries) | |||
How do I fill a cell in a user form from a selection on same form? | Excel Discussion (Misc queries) | |||
user form question: text box to display result | Excel Discussion (Misc queries) | |||
user form question: text box to display result | Excel Worksheet Functions | |||
User form question | Excel Programming |