Hi p45cal,

Thanks for your help, it's been really useful. On friday afternoon I finally achieved to make the code work. I moved the check code from column V to the beginning to do: If ISIN is column A it's in book 2 run the macro, if not go to next ISIN. I attach below a sample of the code. Thanks again for everything!

'Check Act


i = 2


Do While Cells(i, 1).Value <> ""


 If Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:S"), 19, 0) = """" Then
  Cells(i, 22) = "NO"
 Else
  Cells(i, 22) = "SI"
 End If


i = i + 1


On Error Resume Next
Loop

'Preavis Compres


i = 2
x = ActiveSheet.UsedRange.Rows.Count




Do While Cells(i, 1).Value <> ""
 For i = 2 To x
  If Cells(i, 22) = "SI" Then


   If Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 7, 0) = 2 And Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 8, 0) = 1 Then
    Cells(i, 5) = "T+1"
   ElseIf Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 7, 0) = 0 And Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 8, 0) = 0 Then
    Cells(i, 5) = "T+0"
   ElseIf Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 7, 0) = 1 And Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 8, 0) = 1 Then
    Cells(i, 5) = "T-1"
   ElseIf Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 7, 0) = 1 And Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 8, 0) = 2 Then
    Cells(i, 5) = "T-2"
   ElseIf Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 7, 0) = 1 And Application.WorksheetFunction.VLookup(book1.Sheets("Hoja1").Cells(i, 1), book2.Sheets("Hoja3").Range("A:H"), 8, 0) = 3 Then
    Cells(i, 5) = "T-3"
     
   End If
 
  End If
 Next i
i = i + 1
     


 On Error Resume Next