Compara dos columnas (A y D) en Excel. Si coincide, elimine una fila y, si no coincide, resalte con color azul

I have data in four columns (A,B,C & D). Most of the cells in Column D are empty but some are with data.

First I want to compare data of Column D with with Column A. If data is matched then remove the entire row of Column A that correspond to data...and if not match, then data of Column D should be highlighted with Blue color.

preguntado el 10 de septiembre de 12 a las 13:09

may we see your code? where does it fail? -

The edit you made to ChallengeAccepted's answer should be a comment on it. -

1 Respuestas

Create a New Sheet
Copy all required Data in, as a backup in case things go wrong.
Prensa otro+F11 to get to the Visual Basic Editor.
Right Click in the Left hand Pane.
Insert a Module.
Double Click the new module (normally called "Module1")
Copy and Add the Below Code;

Function DeleteDuplicates()

Dim wsSheet As Worksheet

Set wsSheet = ThisWorkbook.Worksheets(1) 'Change this to reflect the correct sheet number


Dim i As Integer

i = 1 'Iterator
Dim Str As String

While (Not wsSheet.Cells(i, 1).Value = "") 'Stop when you run out of column A

    If (wsSheet.Cells(i, 1).Value = wsSheet.Cells(i, 4).Value) Then ' Col A = Col B
        Str = CStr(i) & ":" & CStr(i)
        wsSheet.Range(Str).Delete Shift:=xlUp 'Delete Row:Row
        i = i - 1
    Else 'Blank or Different
        Str = CStr(i) & ":" & CStr(i)
        wsSheet.Cells(i, 4).Interior.ColorIndex = 41 '41 = Mid Blue
        wsSheet.Cells(i, 4).Interior.Pattern = xlSolid
    End If

    i = i + 1 'Increment


End Function

Set the Spreadsheets Index number and you'll be good, so press F5.

Respondido el 14 de Septiembre de 12 a las 05:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.