Row count where data exists

前端 未结 7 1643
广开言路
广开言路 2021-02-08 19:24

I need to count the total number of rows that have data. I want to be able to use this on multiple sheets with different amounts of data rows.

I cannot figure out gener

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-08 19:41

    I found this method on http://www.mrexcel.com/

    This computes the number of non-blank cells in column A of worksheet named "Data"

    With Worksheets("Data")
      Ndt =Application.Range("A:A").Cells.SpecialCells(xlCellTypeConstants).Count
      debug.print Ndt
    End With
    

    The result is printed to the immediate window. You need to subtract 1 (or more) if column A has a header line (or lines) you do not wish to count.

提交回复
热议问题