Anexo el código
Private Sub CommandButton4_Click()
'exportar a hoja
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'
Set l1 = ThisWorkbook
'Set h1 = ActiveSheet
ruta = ThisWorkbook.Path & "\"
arch = ActiveSheet.Name
If h1.AutoFilterMode Then h1.AutoFilterMode = False
u = h1.Range("A" & Rows.Count).End(xlUp).Row
h1.Copy
Set l2 = ActiveWorkbook
Set h2 = l2.Sheets(1)
f1 = CDate(ComboBox1.Value)
If ComboBox2.Value = "" Then
f2 = f1
Else
f2 = CDate(ComboBox2.Value)
End If
'
For i = u To 3 Step -1
If ComboBox3.Value = "" Then
turno = h2.Cells(i, "A")
Else
turno = ComboBox3.Value
End If
If h2.Cells(i, "E") >= f1 And h2.Cells(i, "E") <= f2 And _
h2.Cells(i, "A") = turno Then
Else
h2.Rows(i).Delete
End If
Next
On Error Resume Next
h2.DrawingObjects("Button 1").Delete
On Error GoTo 0
l2.SaveAs Filename:=ruta & arch & ".xlsx", _
FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
l2.Close
MsgBox "Base de datos guardada en ESCRITORIO"
End Sub
sal u dos