Ampliar fórmula en vba de excel

Tengo esta fórmula en la que tu me ayudaste, que dice:

Si G = PAGO y H = TRANSFERENCIA entonces copia en el libro AGOSTO en la hoja TRANSFERECIA

    If Not Intersect(Target, Range("G:H")) Is Nothing Then
        If Target.Count > 1 Then Exit Sub
        If UCase(Cells(Target.Row, "G")) = "PAGO" And _
           UCase(Cells(Target.Row, "H")) = "TRANSFERENCIA" Then
            '
            Application.ScreenUpdating = False
            Set l2 = Workbooks("FACT CANC AGOSTO 2015.xlsm")
            Set h2 = l2.Sheets("TRANSFERENCIA")
            u = h2.Range("D" & Rows.Count).End(xlUp).Row + 1
            Range("B" & Target.Row & ":F" & Target.Row).Copy
            h2.Range("D" & u).PasteSpecial Paste:=xlPasteValues
            Application.CutCopyMode = False
            End If
    End If

pero necesito ahora adicionarle que si I = SI entonces copie la fila en JULIO en la hoja TRANSFERENCIA

1 respuesta

Respuesta
1

H o l a:

Te anexo la macro actualizada, solo ayúdame con el nombre del libro, le puse:

"FACT CANC JULIO 2015.xlsm", revisa si es correcto en la macro. Deberás tener abierto el libro para que la macro funcione.

If Not Intersect(Target, Range("G:H")) Is Nothing Then
    If Target.Count > 1 Then Exit Sub
    If UCase(Cells(Target.Row, "G")) = "PAGO" And _
       UCase(Cells(Target.Row, "H")) = "TRANSFERENCIA" And _
       UCase(Cells(Target.Row, "I")) = "SI" Then
        '
        Application.ScreenUpdating = False
        Set l2 = Workbooks("FACT CANC JULIO 2015.xlsm")
        Set h2 = l2.Sheets("TRANSFERENCIA")
        u = h2.Range("D" & Rows.Count).End(xlUp).Row + 1
        Range("B" & Target.Row & ":F" & Target.Row).Copy
        h2.Range("D" & u).PasteSpecial Paste:=xlPasteValues
        Application.CutCopyMode = False
    End If
End If

S a l u d o s

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas