I tried sumif function through excel vba but i'm getting '#value" error.
Sub xd()
R_lastrow = Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row
R_lastcolumn = Sheets(1).Cells(1, Columns.Count).End(xlToLeft).Column
o_lastrow = Sheets(2).Cells(Rows.Count, 1).End(xlUp).Row
o_lastcolumn = Sheets(2).Cells(1, Columns.Count).End(xlToLeft).Column
For k = 2 To o_lastrow
For j = 2 To o_lastcolumn
Sheets("Sheet2").Cells(k, j).Value = Sheets("Sheet2").Evaluate("SUMIF(Sheet1!&range(cells(2,R_lastrow),cells(2,R_lastcolumn)),range(1,j),Sheet1!&range(cells(j,R_lastrow))")
Next j
Next k
End Sub
Could you please suggest me where i'm wrong