Dear all,

i am a beginner programmer about VBA mainly for Excel Applications.

Please i need your help about a problem that feels me sick.

I try to create the following macro:

1. Open an excel file (and it's ok)


Set lv_workbook = lv_xl_app.Workbooks.Open(lv_FileSelezionato)
2. Load a sheet (and it's ok)

 
Set lv_sheet = lv_workbook.Sheets("MySheet")
3. apply the sumif (it doesn't work with the file loades at point 1 but it works fine with the main sheet)

NOTE: the variables lv_stringa_appogio is a String and lv_counter_hours is Double

lv_sheet.Select

Set wa_ricerca = lv_sheet.Range("A2:A15")

Set wa_da_sommare = lv_sheet.Range("B2:B15")

lv_stringa_appoggio = CStr(Sheets("summary").Cells(i + 1, 1))

lv_counter_hours = Application.WorksheetFunction.SumIf(wa_ricerca, "=" & lv_stringa_appoggio, wa_da_sommare)
The error occurs when i call sumif is Error 13 (i have tried to use only WorksheetFunction.Sumif... but the result is an other error).

i hope in a your help and reply.

Best regards.