Macro para comprar dos archivos

FOTO-I y FOTO-TI), cogiendo como base la columna A y B, si esos datos están iguales en el archivo 2"Foto-TI" entonces que empiece a comparar el resto de columnas y me las ponga en un color.

Te adjunto los archivos al correo explicando requerimiento.

1 respuesta

Respuesta
1

Empiezo a revisar el archivo y te aviso.

¡Gracias!  Quedo pendiente

Te anexo la macro

Sub Comparar()
'Por.Dante Amor
    Application.ScreenUpdating = False
    Set l1 = ThisWorkbook
    Set h1 = l1.Sheets(1)
    Set l2 = Workbooks("FOTO-TI.xlsm")
    Set h2 = l2.Sheets(1)
    h1.Rows("4:" & Rows.Count).Interior.ColorIndex = xlNone
    h2.Rows("4:" & Rows.Count).Interior.ColorIndex = xlNone
    u1 = h1.Range("A" & Rows.Count).End(xlUp).Row
    h2.Columns("BA:BB").ClearContents
    With h1.Range("BA4:BA" & u1)
        .Formula = "=A4&B4"
        .Value = .Value
    End With
    u2 = h2.Range("A" & Rows.Count).End(xlUp).Row
    With h2.Range("BA4:BA" & u2)
        .Formula = "=A4&B4"
        .Value = .Value
    End With
    For i = 4 To u1
        Set b = h2.Columns("BA").Find(h1.Cells(i, "BA"), lookat:=xlWhole)
        If Not b Is Nothing Then
            h2.Cells(b.Row, "BB").Value = "x"
            For j = 3 To Columns("AU").Column
                If h2.Cells(b.Row, j) <> h1.Cells(i, j) Then
                    h2.Cells(b.Row, j).Interior.ColorIndex = 6
                End If
            Next
        Else
            h1.Range(h1.Cells(i, "A"), h1.Cells(i, "B")).Interior.ColorIndex = 6
        End If
    Next
    '
    'registros que están en 2 y no están en 1
    For i = 4 To u2
        If h2.Cells(i, "BB") = "" Then
            h2.Range(h2.Cells(i, "A"), h2.Cells(i, "B")).Interior.ColorIndex = 6
        End If
    Next
    Application.ScreenUpdating = True
    MsgBox "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