Hello,
I have been researching how to take the selections from a listbox and have them displayed in specific columns in a worksheet. I found one thread that was helpful, http://www.mrexcel.com/forum/excel-...-applications-code-selected-item-listbox.html that I copied code from. This extracts my selected items but puts all item in the first column, not in the row under the columns.
Here is an example of what my worksheet looks like when I add a new record to the worksheet. My code is putting the status all under column 43, when what I need is for the state to be put under the identified columns, i.e.; AL=43, AZ=45, CA=46, etc. I'd even be happy if instead of having the state abbreviation entered if it put an X but my main goal is to switch the code from a column entry to a row entry.
<tbody>
</tbody>
Thank you!
Valerie
I have been researching how to take the selections from a listbox and have them displayed in specific columns in a worksheet. I found one thread that was helpful, http://www.mrexcel.com/forum/excel-...-applications-code-selected-item-listbox.html that I copied code from. This extracts my selected items but puts all item in the first column, not in the row under the columns.
Code:
'At least 1 row selected
Dim I As Long
Dim J As Long
Dim arrItems()
ReDim arrItems(0 To lbxStatesOfferingUBI.ColumnCount - 1)
For J = 0 To lbxStatesOfferingUBI.ListCount - 1
If lbxStatesOfferingUBI.Selected(J) Then
For I = 0 To lbxStatesOfferingUBI.ColumnCount - 1
arrItems(I) = lbxStatesOfferingUBI.Column(I, J)
Next I
With Sheets("Data")
Cells(.Rows.Count, 43).End(xlUp).Offset(1).Resize(, lbxStatesOfferingUBI.ColumnCount).Value = arrItems
End With
End If
Next J
Here is an example of what my worksheet looks like when I add a new record to the worksheet. My code is putting the status all under column 43, when what I need is for the state to be put under the identified columns, i.e.; AL=43, AZ=45, CA=46, etc. I'd even be happy if instead of having the state abbreviation entered if it put an X but my main goal is to switch the code from a column entry to a row entry.
<colgroup><col><col><col><col span="6"><col><col span="42"></colgroup><tbody> </tbody> |
<tbody>
</tbody>
Thank you!
Valerie