The script works fine if i put: ThisWorkbook but with ActiveWorkbook  doesn't work. 
Error 1004 say: "Unable to get the Match property of the Worksheet function class"
Dim dat As Date
calea_livrat = "my link" & ".xlsx"
Workbooks.Open calea_livrat
With ActiveWorkbook
    dat = zi & "-" & luna & "-" & an
    data_gen = CDbl(dat)
    nr_linie = Application.WorksheetFunction.Match(data_gen, ActiveWorkbook.Worksheets("PE_Centralizare").Range("A:A"), 0)
    MsgBox nr_linie
End With
Something is wrong here: Application.WorksheetFunction.Match(data_gen, ActiveWorkbook.Worksheets("PE_Centralizare").Range("A:A"), 0) but i can't figure out what.
 
    