Hi
I have this code
should copy selected item from listbox to worksheet. indeed the code just copy the first column for selected item from listbox .
what I want copying the whole lastrow from listbox to row 2 in OUT sheet without select item.
thanks
I have this code
VBA Code:
Private Sub CommandButton1_Click()
Dim i As Long
Dim ary
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("OUT")
ReDim ary(0 To 0)
With Me.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
ReDim Preserve ary(1 To UBound(ary) + 1)
ary(UBound(ary)) = .List(i)
End If
Next
End With
ws.Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(UBound(ary)).Value _
= Application.Transpose(ary)
End Sub
what I want copying the whole lastrow from listbox to row 2 in OUT sheet without select item.
thanks