VBA Subscript out of range - error 9

后端 未结 3 1492
悲&欢浪女
悲&欢浪女 2020-12-02 00:35

Can somebody help me with this code, I am getting a subscript out of range error:

\"enter

3条回答
  •  独厮守ぢ
    2020-12-02 01:04

    Subscript out of Range error occurs when you try to reference an Index for a collection that is invalid.

    Most likely, the index in Windows does not actually include .xls. The index for the window should be the same as the name of the workbook displayed in the title bar of Excel.

    As a guess, I would try using this:

    Windows("Data Sheet - " & ComboBox_Month.Value & " " & TextBox_Year.Value).Activate
    

提交回复
热议问题