hi
I got this code for @Norie
it just copies one column from list box into sheet when select specific rows from listbox , but I want copying all of the columns from list box to sheet when select rows from listbox .
the columns in listbox are 8 and the sheet are from A:H
cany anybody help me , please?
I got this code for @Norie
VBA Code:
Private Sub CommandButton1_Click()
Dim I As Long
Dim cnt As Long
Dim arr()
With ListBox1
If .ListCount = 0 Then
MsgBox "No data in listbox."
Exit Sub
End If
For I = 0 To .ListCount - 1
If .Selected(I) Then
ReDim Preserve arr(cnt)
arr(cnt) = .List(I)
cnt = cnt + 1
End If
Next I
End With
If cnt = 0 Then
MsgBox "No data selected."
Else
Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(UBound(arr) + 1).Value = Application.Transpose(arr)
End If
End Sub
the columns in listbox are 8 and the sheet are from A:H
cany anybody help me , please?