Select range in a particular sheet in excel vba

前端 未结 1 1990
别跟我提以往
别跟我提以往 2020-12-21 03:37

I have a question about selecting a range in a particular sheet using excel vba.

I don\'t know why the following is not working:

Thisworkbook.Sheets         


        
相关标签:
1条回答
  • 2020-12-21 04:18

    You've basically answered your own question. Here's an excerpt from Excel 2003 help:

    "If you use the Select method to select cells, be aware that Select works only on the active worksheet. If you run your Sub procedure from the module, the Select method will fail unless your procedure activates the worksheet before using the Select method on a range of cells."

    More importantly, remember that it's rarely necessary to use Select in VBA, and it should be avoided if possible.

    0 讨论(0)
提交回复
热议问题