Donde colocar la siguiente línea a una macro
Ayúdame a colocar la línea que limpia celdas a la sigte macro:
Sub BuscarMatriculas()
'Por.Dante Amor
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set l1 = ThisWorkbook
Set h1 = l1.Sheets("hoja1")
'
If h1.[A5] = "" Then
MsgBox "MARIA, FAVOR PONER LA FECHA DEL DIA"
Exit Sub
End If
'
ruta = "D:\CENTRO EDUCATIVO FE Y ESPERANZA\carpeta de factura\"
'ruta = l1.Path & "\archivos\"
arch = Dir(ruta & h1.[N5] & "*.xls*")
col = "IT"
Do While arch <> ""
If arch <> l1.Name Then
Set l2 = Workbooks.Open(ruta & arch)
Set h2 = l2.Sheets(1)
If h2.[N5] = h1.[A5] Then
u = 8
Do While h1.Cells(u, "J") <> ""
u = u + 1
Loop
h1.Cells(u, "D") = h2.[L13]
h1.Cells(u, "C") = h2.[H13]
h1.Cells(u, "B") = h2.[D13]
h1.Cells(u, "E") = h2.[D17]
h1.Cells(u, "F") = h2.[D20]
h1.Cells(u, "J") = h2.[O18]
h1.Cells(u, "I") = h2.[E7]
h1.Cells(u, "G") = h2.[L11]
h1.Cells(u, "A") = h2.[N6]
h1.Cells(u, col) = arch
End If
l2.Close False
End If
arch = Dir()
Loop
Application.ScreenUpdating = True
MsgBox "YA TERMINE, MARIA"
End Subla linea:
("B10:E232"). ClearContents
2 respuestas
Respuesta de Adriel Ortiz Mangia
1
Respuesta de Dante Amor
1
