VBA: Selecting range by variables

前端 未结 6 911
甜味超标
甜味超标 2020-12-02 21:28

I want to select the formatted range of an Excel sheet. To define the last and first row I use the following functions:

lastColumn = ActiveSheet.UsedRange.Co         


        
6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 22:08

    you are turning them into an address but Cells(#,#) uses integer inputs not address inputs so just use lastRow = ActiveSheet.UsedRange.Rows.count and lastColumn = ActiveSheet.UsedRange.Columns.Count

提交回复
热议问题