hi All,
I managed to find a bit code for a userform im working on, i have 2 listboxes, Multiextended, i can transfer from listbox1 to listbox 2 ok, checkbox to select all, move items back n forward, but the code I have to copy listbox2 to a sheet called Cert_Input finding the first blank cell in E seems to take forever, any help?
Private Sub CommandButton1_Click()
Dim Litem As Long, LbRows As Long, LbCols As Long
Dim bu As Boolean
Dim Lbloop As Long, Lbcopy As Long
LbRows = ListBox2.ListCount - 1
For Litem = 0 To LbRows
If ListBox2.Selected(Litem) = True Then
bu = True
Exit For
End If
Next
If bu = True Then
With Sheets("Cert_Input").Cells(Rows.Count, 5).End(xlUp).Offset(1, 0)
For Litem = 0 To LbRows
If ListBox2.Selected(Litem) = True Then 'Row selected
'Increment variable for row transfer range
Lbcopy = Lbcopy + 1
For Lbloop = 0 To LbCols
'Transfer selected row to relevant row of transfer range
.Cells(Lbcopy, Lbloop + 1) = ListBox2.List(Litem, Lbloop)
Next Lbloop
End If
Next
End With
Else
MsgBox "Nothing chosen", vbCritical
End If
MsgBox "The Selected Data Are Copied.", vbInformation
End With
End Sub
Bookmarks