Excel Select vs Activate

后端 未结 6 1766
轻奢々
轻奢々 2020-12-01 10:39

What is the difference between the VBA code wb.Sheets(1).Cells.Select and wb.Sheets(1).Activate?

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 11:22

    The first selects all cells on the first sheet of the workbook wb. It will fail if the sheet is not active.

    The second just activates the first sheet of the workbook wb. It does not alter the selection or activecell on that sheet, and in some cases there may be no selected range or activecell (eg. if there's an object on the sheet which is currently selected).

提交回复
热议问题