How to check if Excel range is free in C #

I want to check if a range (cells in a row column *) is free with C #. I can go through the cells, but any quick and fast way? Any method to get the range from the selected / active cell and the number of rows and column?

+6
source share
1 answer

I believe that Excel.WorksheetFunction.CountA works not only with sheets, but with any Range argument:

Use CountA to count the number of cells containing data in a range or array.

A value is any type of information, including error values ​​and empty text (""). The value does not contain empty cells.

If the argument is an array or reference, only the values ​​in this array or reference are used. Empty cells and text values ​​in the array or reference are ignored.

+12
source

Source: https://habr.com/ru/post/893744/


All Articles