简体   繁体   中英

Count filled cells in a certain rows in each column

I want to count filled cells from each column and from row 14 to 45. I'm using below code to find the count of filled cells in a fixed range but unable to check for each column as I'm unable to make 1st row in range type cells(row,column) format. Any help please.

Range("A14", Range("A14").End(xlDown)).Select
m = Selection.Rows.Count

Not sure I understand, but this will look at everything between A14 and the last filled cell in A:

msgbox worksheetfunction.counta(range("A14",range("A" & rows.count).end(xlup)))

If for several columns perhaps this?

Sub x()

Dim c As Long

For c = 1 To 10 'A to J
    MsgBox WorksheetFunction.CountA(Range(Cells(14, c), Cells(45, c)))
Next c

End Sub

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