Hi all,
I tried with the below command and i can't paste the selected values in listbox to a new workbook. with that command i can open the workbook but the selected values are not pasting in the new workbook. can suggest any solution.
Code
Private Sub CommandButton2_Click()
Dim wkb As Workbook
'Adding New Workbook
Set wkb = Workbooks.Add
Dim i As Integer
With wkb
.Worksheets("Sheet1").Activate
End With
r = 1
For i = 1 To ListBox1.ListCount - 1
If Me.ListBox1.Selected(i) Then
With Sheet1
.Cells(r, 1).Value = Me.ListBox1.List(i, 0)
.Cells(r, 2).Value = Me.ListBox1.List(i, 1)
.Cells(r, 3).Value = Me.ListBox1.List(i, 2)
r = r + 1
End With
End If
Next
End Sub
Display More