first blank row in excel
c#, excel, vsto
Solution
If App is your excel application, you can loop throught the rows starting from number 1 and look for the first empty using CountA function (it returns the number of non empty cells for a Range):
int rowIdx = 0;
int notEmpty = 1;
while (notEmpty > 0)
{
string aCellAddress = "A" + (++rowIdx).ToString();
Range row = App.get_Range(aCellAddress, aCellAddress).EntireRow;
notEmpty = _App.WorksheetFunction.CountA(row);
}
When the while loop exits, rowIdx is the index of the first empty row.
CountA receive other 29 optional arguments, so it is possible that you have to pass Missing.Value 29 times with earlier versions of the framework.
Problem
Is there a way to find first available blank row in excel sheet using vsto or c# ? I have been searching for hours but cant find any thing related to it. Any help in this regard will be greatly appreciated