Write Cell: Index was outside the bounds of the array

Can you share the input and a snippet of the code.