Te anexo el código, solamente ayúdame poniendo en la macro el nombre del libro en esta línea, cambia "libro2.xlsx" por el nombre de tu libro real
libro2 = "libro2.xlsx" 'nombre del libro con todo y extensión
La macro completa:
Private Sub CommandButton2_Click()
'Por.Dante Amor
Dim i, libro2, lib, existe, l2, h2, fila
'
libro2 = "libro2.xlsx" 'nombre del libro con todo y extensión
'
If ListBox1.ListCount = 0 Then
MsgBox "No hay registros a pasar"
Exit Sub
End If
existe = False
For Each lib In Workbooks
If LCase(lib.Name) = LCase(libro2) Then
existe = True
End If
Next
If existe = False Then
MsgBox "El libro 2 no está abierto"
Exit Sub
End If
'
Set l2 = Workbooks(libro2)
Set h2 = l2.Sheets(1)
fila = 4
h2.Range("A" & fila & ":I" & Rows.Count).ClearContents
For i = 0 To ListBox1.ListCount - 1
H2.Cells(fila, "A") = ListBox1.List(i, 0)
H2.Cells(fila, "D") = ListBox1.List(i, 1)
H2.Cells(fila, "E") = ListBox1.List(i, 2)
H2.Cells(fila, "G") = ListBox1.List(i, 3)
H2.Cells(fila, "I") = ListBox1.List(i, 4)
fila = fila + 1
Next
MsgBox "Datos exportados"
End Sub
'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias