0

Is there a way to find the length of a row in VBA (counting only cells that are not empty)? Thank you in advance.

  • obviously he wants to count the cells in an Excel sheet row that are not empty – mdo Jul 19 '12 at 20:59
  • Sorry for the confusion. I am looking for a way to count the number of cells in a row that are not empty. Thank you all again. – user1539107 Jul 19 '12 at 21:04
  • Something like `=COUNTA(1:1)` will return the number of nonblank cells in row 1. Is that what you want? – JimmyPena Jul 19 '12 at 22:31

1 Answers1

0

If your thought of "length" matches the last non-empty cell: Last non-empty cell in a column

=INDEX(A:A,MAX((A:A<>"")*(ROW(A:A))))

Excel 2007+

Community
  • 1
  • 1
mdo
  • 6,961
  • 3
  • 24
  • 26