简体   繁体   中英

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))

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM