none
Subscript Out Of Range Error - 9 RRS feed

  • Question

  • I have a general question regarding the "Subscript Out Of Range" error that I am getting when I execute a macro.  This macro has been in place for over a year and worked for me at one time.  Others are currently using the macro and have no issues with it.  So this macro is working for several different people on several different workstations and it used to work for me.  I did receive a new workstation about a month ago.  This macro is basically opening one workbook and copying data from it into another workbook.  Is there a setting/option that needs to be adjusted in Excel when working with multiple worksheets?  I'm thinking maybe there is a setting that I had in my previous version of Excel that I do not have in this current version.  I am using Microsoft Office Professional Plus 2013.  Thank you!
    Thursday, June 22, 2017 4:17 PM

All replies

  • Hello,

    There were no breaking changes in the Excel object model. Most probably you are trying to access a named range or worksheet which has a different name. Did you try to debug the code? What line of code generates an error? 


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Thursday, June 22, 2017 4:29 PM
  • Hi MSH6482,

    you had only post the description of the issue.

    we are not able to reproduce the issue from only your description.

    please try to post your sample code.

    we will try to check the code on our side and try to reproduce the issue.

    then we can provide you a solid suggestion to solve the issue.

    in general, you can try to debug the code and find that problematic line.

    then you can try to check that line.

    generally this error occurs when you work with array in your code.

    please visit the link below in which you will find the possible causes for this error.

    Subscript out of range (Error 9)

    from the link above you can try to test your code and try to solve the issue. if then also you are not able to solve it then you can post your code here. we will try to help you further to solve the issue.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, June 23, 2017 12:58 AM
    Moderator
  • I figured out the issue on why the macro would not work for me and it would work for everyone else.  I did not have the file extension option selected whenever I was viewing files in folders.  I solved my problem by doing the following...

    1. Click "Start" button

    2. Type "Folder Options" in the search window.

    3. Click "Folder Options" after the window appears.

    4. Uncheck the "Hide extensions for known file types" option.

    I'm guessing the macro was failing because the code could not file the appropriate files that the macro was looking for because there were no file extension on my workstation.

    Friday, June 23, 2017 1:19 PM
  • Eugene,

        I posted how I resolved my issue.  See in thread below.

    Friday, June 23, 2017 9:35 PM
  • Deepak,

        I posted how I resolved my issues.  See thread below.

    Friday, June 23, 2017 9:36 PM
  • Hi MSH6482,

    Thanks for sharing the solution.

    I would suggest you mark your reply as answer to close this thread, and then others who run into the same issue would find the solution easily.

    Regards,

    Edward


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, June 26, 2017 3:05 AM