Hello, can anyone tell me why my code does not work?
Code:
Sub Cross()
Dim nombre As Range
Dim rut As Range
Dim marca As Range
Dim modelo As Range
Dim patente As Range
Dim motor As Range
Dim row As Integer
With Sheets("DTT")
Set nombre = Range("A4:A186")
Set rut = Range("C4:C186")
Set marca = Range("F4:F186")
Set modelo = Range("G4:G186")
Set patente = Range("J4:J186")
Set motor = Range("K4:K186")
End With
Sheets("Nomina").Activate
Do While ActiveCell.Value = ""
row = ActiveCell.row
ActiveCell.Value = Application.WorksheetFunction.Index(Sheets("DTT").Range("patente"), Application.WorksheetFunction.Match(Cells(row, 1) & Cells(row, 6) & Cells(row, 8) & Cells(row, 9), Sheets("DTT").Range("nombre") & Sheets("DTT").Range("rut") & Sheets("DTT").Range("marca") & Sheets("DTT").Range("modelo"), 0))
ActiveCell.Offset(0, 1).Value = Application.WorksheetFunction.Index(Sheets("DTT").Range("motor"), Application.WorksheetFunction.Match(Cells(row, 1) & Cells(row, 6) & Cells(row, 8) & Cells(row, 9), Sheets("DTT").Range("nombre") & Sheets("DTT").Range("rut") & Sheets("DTT").Range("marca") & Sheets("DTT").Range("modelo"), 0))
ActiveCell.Offset(1, -1).Activate
Loop
End Sub
Last edited by a moderator: