Macro para concentrado mensual de 2 libros de excel

Dante amor me ayudó mucho la anterior macro pero tengo otra, si me pudieras ayudar de favor, tengo 2 libros uno se llama prototipo que es donde van a capturar todo en hoja diaria, el campo interesante es la captura de clave en base a ese quiero que lo que está en los campos seguro popular, excento y vendido se sumen de acuerdo a la clave y se pongan en el libro formato interno de medicamentos de acuerdo al campo.

Respuesta
1

Esto a lo mejor suma algo más

https://youtu.be/hJHTspgfavI

https://youtu.be/TOXRk5oWLW4

1 respuesta más de otro experto

Respuesta
1

Te anexo la macro

Sub Sumar_Por_Clave()
'
' Por Dante Amor
'
    '
    Application.ScreenUpdating = False
    Set l1 = ThisWorkbook
    Set h1 = l1.Sheets("HOJA DIARIA")
    '
    libro2 = h1.[N1]
    If libro2 = "" Then
        MsgBox "Falta el libro formato en la celda N1"
        Exit Sub
    End If
    existe = False
    For Each libro In Workbooks
        If LCase(libro.Name) = LCase(libro2) Then
            existe = True
            Exit For
        End If
    Next
    If existe = False Then
        MsgBox "Abrir el libro formato"
        Exit Sub
    End If
    '
    Set l2 = Workbooks(libro2)
    Set h2 = l2.Sheets("ABRIL")
    u2 = h1.Range("A" & Rows.Count).End(xlUp).Row
    h2.Range("H12:J" & u2).ClearContents
    '
    For i = 7 To h1.Range("C" & Rows.Count).End(xlUp).Row
        clave = h1.Cells(i, "C")
        Set b = h2.Columns("A").Find(clave, lookat:=xlWhole)
        If Not b Is Nothing Then
            h2.Cells(b.Row, "H") = h2.Cells(b.Row, "H") + h1.Cells(i, "F")
            h2.Cells(b.Row, "I") = h2.Cells(b.Row, "I") + h1.Cells(i, "J")
            h2.Cells(b.Row, "J") = h2.Cells(b.Row, "J") + h1.Cells(i, "K")
        End If
    Next
    Application.ScreenUpdating = True
    MsgBox "Suma Termiada", vbInformation, "FIN"
End Sub

.

'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias

.

Avísame cualquier duda

.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas