See the line
For k As Integer = 0 To Data1.ColumnCount - 4
You are ignoring the last 3 columns. That line should probably read
For k As Integer = 0 To Data1.ColumnCount - 1
Or you could use
For Each
to avoid the problem.
Also look at line
For j = 0 to Data1.Rows.Count - 2
You are ignoring the last row. That line should probably read
For j = 0 to Data1.Rows.Count - 1
Now look at your inner loop
For i = 0 To EOF()
i = i + 1
You are incrementing the counter
i
within the
For
loop, so the first time through that loop i = 1 (not 0). The second time through the loop i = 3 not 1, third time 5 not 2 and so on. I can't really understand why you have three loops to traverse a two-dimensional object and I have no idea what the function EOF() is doing.
You also need to understand that each column in the grid has the same number of "rows" - Grids have Rows (and Columns), Columns do not.
You've already had a go at debugging but didn't notice these issues, so hopefully this article -
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[
^] - will help you become more proficient