I am trying to check for empty rows in a excel range by iterating the data table with a condition. The problem is that one of the cells in the row always contains “0.00” due to a calculation macro in that particular cell. So I’m trying to create a condition which first checks if the row is empty and also if that particular cell is not null or empty, like this:
The excel sheet contains several rows and it always work for the first one, but not the rest. I have tried several combinations in the condition but can’t seem to get it right.
Also when I output the data table the empty rows always turn out like this:
,0, The number of characters in this matches the number of columns I have in my DataTable.
Does this mean that every cell have a comma hidden in them? And the zero is the calculation of “0.00”?
How would I in this case manage to get the first empty row?
Column 12 contains the calculation that I previously mentioned. When there is no value in that cell it contains "0.00. That is why the last row (4) in the picture never turns out like an empty row. I would like to fetch the first empty row with a condition that ignores the cell value of Column 12.
I consider an empty row as row 4, no values in any of the cells except from column 12 where it always Will be a calculation value. Thank you in advance!
but will you have empty rows in the middle of the data or only the final row? The best thing is to delete the last row so you dont have to check them… when you do the read range your data table should not have empty rows…
IF (String.Join("", row.ItemArray.Select(Function(p) p.ToString).ToArray).Lenght > 0 AND Convert.ToDouble(row("Column 12"))<>0.00)