Reputation: 85
I am looking for a way to count non-empty element in a 2 dimensions array.
I have read a solution here VBA count non empty elements of array. However I think there may be a better way or function to perform it.
To count non-empty cells in a range (A1:J10), we use this in Excel VBA
k = Application.WorksheetFunction.CountA(Range(Cells(1, 1), Cells(10, 10)))
I am looking for similar function to count non-empty elements in an array. For instance, I tried this
k = Application.WorksheetFunction.CountA(Array(1,1),Array(10,10))
But it does not work. Is there such function to count non-empty element in array?
I need to count this because I would like to delete the entire rows in an array when all elements of the same rows in an array are empty.
Upvotes: 5
Views: 5585