Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a userform with a MultiSelect listbox. How do I write a code to use
the item(s) selected by clicking a CommandButton on the same userform? What I am trying to make happen is for the selcted items replace the entry in the D column of the origin WS("Complete Listing") with the name of the WS from which the UserFrom is activated. Then it would copy the rows A-F and paste them in the WS it was activated from starting in row 9. Here is what the code looks like now. Private Sub UserForm_Initialize() ' Identifying elements Dim ListBoxRange As Range Dim LastRow As Long ' Identifying which sheet to pull info from With Worksheets("Complete Listing") 'Telling it to count to the last used cell in column "F" LastRow = .Cells(.Rows.Count, "F").End(xlUp).Row 'Telling it to set the range from A4 to F(LastRow) Set ListBoxRange = .Range("A4:F" & LastRow) End With 'Operations on the item checkout listbox With Me.ListBox1 'Clearing data from the list .Clear 'counting the number of columns .ColumnCount = ListBoxRange.Columns.Count 'telling it to use the range set above for the listbox .List = ListBoxRange.Value End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selected listbox item | Excel Programming | |||
Selected ListBox item to TextBox | Excel Programming | |||
Worksheet Listbox selected item? | Excel Programming | |||
Delete selected Item from listbox | Excel Programming | |||
How to get the index in VBA of the selected item in a ListBox | Excel Programming |