Modificar macro para que lea hasta columna ¨¨K¨¨

Dante, anexo envío la macro creada por ud. Y uno de los libros para que ud. Vea hasta donde necesito que la macro lea:

la 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 "ELIDA, FAVOR PONER LA FECHA DEL DIA"
        Exit Sub
    End If
    '
    ruta = "D:\COLEGIO CLAREN LEHMAN\CARPETA GENERAL DE FACTURA-22-23\"
    'ruta = l1.Path & "\archivos\"
    arch = Dir(ruta & h1.[N5] & "*.xls*")
    col = "IT"
    '
    uf = h1.Range("J" & Rows.Count).End(xlUp).Row
    If uf < 8 Then uf = 8
    h1.Range("A8:J" & uf).ClearContents 'aquí va la línea h1.range("B10:E232").clearcontents
    '
    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.[D18]
                h1.Cells(u, "F") = h2.[D20]
                h1.Cells(u, "K") = h2.[O18]
                h1.Cells(u, "J") = h2.[E7]
                h1.Cells(u, "G") = h2.[L11]
                h1.Cells(u, "A") = h2.[N6]
                h1.Cells(u, "H") = h2.[D17]
                h1.Cells(u, col) = arch
            End If
            l2.Close False
        End If
        arch = Dir()
    Loop
    Application.ScreenUpdating = True
    MsgBox "YA TERMINE, ELIDA"
End Sub

Añade tu respuesta

Haz clic para o