Row count where data exists

前端 未结 7 1642
广开言路
广开言路 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:52

    If you need VBA, you could do something quick like this:

    Sub Test()
        With ActiveSheet
        lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
        MsgBox lastRow
        End With
    End Sub
    

    This will print the number of the last row with data in it. Obviously don't need MsgBox in there if you're using it for some other purpose, but lastRow will become that value nonetheless.

提交回复
热议问题