Robert Kendall February 2016

count nonempty cells in a row excel vba

Having trouble with syntax while trying to count nonempty cells in a row(in this example, row two), excel vba.

Have tried .rows(2:2) .rows(2) .cells(B1:B999) received errors with all three.

    Dim intCount As Integer
    intCount = CountA(ActiveSheet.Rows(2, 2))

Answers


Jordan Biddlecombe February 2016

CountA is not a VBA function, it is a worksheet function. Try this:

Dim intCount as integer
intCount = Application.WorksheetFunction.CountA(Activesheet.Rows(2))

Post Status

Asked in February 2016
Viewed 2,679 times
Voted 13
Answered 1 times

Search




Leave an answer