K
KimberlyC
Hi
I rec'd some help today from the newsgroup (Michael J. Malinsky)... I posted
a question back..but after reading it realized I might not have explained it
very well.
He gave me this code below (that works great) that populates a listbox in a
userform with data in cells starting with D9 to M11 on the active
worksheet. The listbox is populated with multiple cells for each item
....for example .. (d9,d10,and d11 make up one item in the list box...and e9,
e10, and e11 make up the next item in the listbox and so on unitl you each
m9, m10, and m11)
Sub UserForm_Initialize()
Dim x As Integer
ListBox1.ColumnCount = 3
For x = 4 To 13
ListBox1.AddItem (ActiveSheet.Cells(9, x).Value)
ListBox1.List(ListBox1.ListCount - 1, 1) = _
ActiveSheet.Cells(10, x).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = _
ActiveSheet.Cells(11, x).Value
Next x
End Sub
Once the listbox is populated ..... the user then multi selects the items
they want to copy.
These items are then copied to another worksheet in coulmn B starting with
cell 14 (going down).
To execute the code ... the user clicks a command button and the following
code runs:
Dim i As Integer
Dim j As Integer
With listbox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Range("description").Offset(j, 0).Value = .List(i)
j = j + 1
End If
Next i
End With
This works...but it only copies and pastes the data in the first cell of
each item listed in the listbox (d9, e,9, f9, and so on) .
I need it to pick up the other cells that make up the item in the list box.
Not sure how to change the code to do that!!
Any help is greatly appreciated.
Thanks in advance..
Kimberly
I rec'd some help today from the newsgroup (Michael J. Malinsky)... I posted
a question back..but after reading it realized I might not have explained it
very well.
He gave me this code below (that works great) that populates a listbox in a
userform with data in cells starting with D9 to M11 on the active
worksheet. The listbox is populated with multiple cells for each item
....for example .. (d9,d10,and d11 make up one item in the list box...and e9,
e10, and e11 make up the next item in the listbox and so on unitl you each
m9, m10, and m11)
Sub UserForm_Initialize()
Dim x As Integer
ListBox1.ColumnCount = 3
For x = 4 To 13
ListBox1.AddItem (ActiveSheet.Cells(9, x).Value)
ListBox1.List(ListBox1.ListCount - 1, 1) = _
ActiveSheet.Cells(10, x).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = _
ActiveSheet.Cells(11, x).Value
Next x
End Sub
Once the listbox is populated ..... the user then multi selects the items
they want to copy.
These items are then copied to another worksheet in coulmn B starting with
cell 14 (going down).
To execute the code ... the user clicks a command button and the following
code runs:
Dim i As Integer
Dim j As Integer
With listbox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Range("description").Offset(j, 0).Value = .List(i)
j = j + 1
End If
Next i
End With
This works...but it only copies and pastes the data in the first cell of
each item listed in the listbox (d9, e,9, f9, and so on) .
I need it to pick up the other cells that make up the item in the list box.
Not sure how to change the code to do that!!
Any help is greatly appreciated.
Thanks in advance..
Kimberly