How to select a range of the second row to the last row

前端 未结 2 1832
误落风尘
误落风尘 2021-02-04 16:10

I am currently trying to figure out how to select a range from the second row to the last row, but more specifically between a range of columns. For instance I want to select Ra

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-04 17:13

    Sub SelectAllCellsInSheet(SheetName As String)
        lastCol = Sheets(SheetName).Range("a1").End(xlToRight).Column
        Lastrow = Sheets(SheetName).Cells(1, 1).End(xlDown).Row
        Sheets(SheetName).Range("A2", Sheets(SheetName).Cells(Lastrow, lastCol)).Select
    End Sub
    

    To use with ActiveSheet:

    Call SelectAllCellsInSheet(ActiveSheet.Name)
    

提交回复
热议问题