How can I find last row that contains data in a specific column?

后端 未结 13 1585
南笙
南笙 2020-11-22 03:44

How can I find the last row that contains data in a specific column and on a specific sheet?

13条回答
  •  醉酒成梦
    2020-11-22 04:13

    I would like to add one more reliable way using UsedRange to find the last used row:

    lastRow = Sheet1.UsedRange.Row + Sheet1.UsedRange.Rows.Count - 1
    

    Similarly to find the last used column you can see this

    Result in Immediate Window:

    ?Sheet1.UsedRange.Row+Sheet1.UsedRange.Rows.Count-1
     21 
    

提交回复
热议问题