SolverLoad Range - Subscript out of Range (Excel VBA) RRS feed

  • Question

  • Hi All,

    Sorry for the obvious vagaries of my post but i've inherited some code in an excel workbook from a long-gone employee and i'm really struggling to get the solver load function to run.  I've got the add-in enabled and it appears as a reference within the project so i'm not too worried about that.  However, using the below code, i get the "9 - Subscript out of range" error.

    SolverLoad loadArea:=Range("AD1:AD10")

    I've tried modifying the code to select the correct sheet immediately before this line but still i get the error.  Is there anything that I could be missing?

    The original code was written in an older version of office (possibly even 32bit) and we're now running office 2016 - could there be a version issue/ conflict?

    As I say, i'm very sorry about the vagueness of this post - i'm not 100% sure I can upload the whole workbook as the calculations within it may be proprietary.

    Many thanks,


    Tuesday, October 15, 2019 11:25 AM

All replies

  • Hi,

    Are you using the old workbook left by a long-gone employee, or borrowing the old code/VBA made by him/her into a new workbook? 

    If it is the latter, please add Solver add-in in the workbook.
    Using the Solver VBA Functions


    Ashidacchi --

    Tuesday, October 15, 2019 11:00 PM