Pasar para imprimir solo ciertos items seleccionados en listbox
He modificado una macro de la autoria de Dante con otras macros, que pasa los items del lisbox. Pwro tengo el inconveniente que cuando requiero pasar solo los items que selecciono. Es decir carga 50 items pero solo ocupo 10 por decir algo y al ejecutar los pasa todos. Otro inconveniente es que si no selecciono ninguno crea la hoja y los encabezados y luego envía el mensaje que no hay datos a imprimir.
Tengo activo fmmultiselectmulti
Agradecería su ayuda.
Private Sub CommandButton3_Click()
Set h = Worksheets.Add
h.Cells.Clear
h.Range("A1:H1") = Array("N° CHEQUE", "DOCUMENTO N°", "FECHA", "MONTO", "GIRADO A", "CONCEPTO", "BANCO", "OPERACION")
h.Range("A2:h200").NumberFormat = "General"
For x = 0 To Listbox1.ListCount - 1
If Listbox1.Selected(x) = True Then
For i = 0 To Listbox1.ListCount - 1
h.Cells(i + 2, "A") = Listbox1.List(i, 0)
h.Cells(i + 2, "B") = Listbox1.List(i, 1)
h.Cells(i + 2, "C") = Listbox1.List(i, 2)
h.Cells(i + 2, "D") = Listbox1.List(i, 3)
h.Cells(i + 2, "E") = Listbox1.List(i, 4)
h.Cells(i + 2, "F") = Listbox1.List(i, 5)
h.Cells(i + 2, "G") = Listbox1.List(i, 7)
h.Cells(i + 2, "H") = Listbox1.List(i, 8)
Call formatlistbox
Next i
End If
Next x
u = h.Range("A" & Rows.Count).End(xlUp).Row
If u = 1 Then
MsgBox "No hay registros a imprimir"
Else
h.PrintOut Copies:=1, Collate:=True
ActiveWindow.SelectedSheets.Delete
End If
End Sub