Reputation: 1054
I have a worksheet and one column of work sheet has more number of rows and remaining columns has different number of rows. I had a requirement like need to get the rowcount of those columns only not the irrelevant column. I had used the below code to get the rowcount but it is Counting by adding the rows in columns with the rows in irrelevant column.
For Example if I use the below code for the For the worksheet shown in image I am getting 6 but I need to get the 3.
int RowCount = workSheet.Rows().Count();
See the below image:
Upvotes: 2
Views: 3224
Reputation: 1054
To get the Count of Specified Rows we Can use the below code
int RowCount = workSheet.Range("A2:k2").RowsUsed().Count();
Upvotes: 3