My index match loop had worked perfectly in a restricted sample, but when I expanded it to the whole sample it crashed. The problem is that at some point, it finds a value that cannot find in the rows range. It stops writing exactly in that cell. I tried to use isError, but it did not change anything and the code stops in the same cell.
Can you help me out please?!
Thanks!
Set inputs = Sheets("Inputs")
Set raw = Sheets("Raw")
Set interm = Sheets("Rel_Raw")
Set finaldata = Sheets("Data")
For i = cols + 1 To cols_2 Step 1
For j = 2 To entries_r Step 1
If Not IsError(finaldata.Cells(j, i).Value = Application.Index(interm.Range(interm.Cells(1, 1), interm.Cells(dim_r, dim_c)), IsError(Application.Match(finaldata.Cells(j, 1).Value, interm.Columns(1), 0)), IsError(Application.Match(finaldata.Cells(1, i).Value, interm.Rows(1), 0)))) Then
finaldata.Cells(j, i).Value = Application.Index(interm.Range(interm.Cells(1, 1), interm.Cells(dim_r, dim_c)), Application.Match(finaldata.Cells(j, 1).Value, interm.Columns(1), 0), Application.Match(finaldata.Cells(1, i).Value, interm.Rows(1), 0))
Else
finaldata.Cells(j, i).Value = 0
End If
Next j
Next i