Meaning of .Cells(.Rows.Count,“A”).End(xlUp).row

前端 未结 4 1772
日久生厌
日久生厌 2020-12-04 11:12

I was just wondering if you could help me better understand what .Cells(.Rows.Count,\"A\").End(xlUp).row does. I understand the portion before the .End

4条回答
  •  一个人的身影
    2020-12-04 12:00

    .Cells(.Rows.Count,"A").End(xlUp).row
    

    I think the first dot in the parenthesis should not be there, I mean, you should write it in this way:

    .Cells(Rows.Count,"A").End(xlUp).row
    

    Before the Cells, you can write your worksheet name, for example:

    Worksheets("sheet1").Cells(Rows.Count, 2).End(xlUp).row
    

    The worksheet name is not necessary when you operate on the same worksheet.

提交回复
热议问题