+ Reply to Thread
Results 1 to 4 of 4

Run time error 1004 SOLVER

  1. #1
    Registered User
    Join Date
    02-28-2013
    Location
    denmark
    MS-Off Ver
    Excel 2010
    Posts
    23

    Run time error 1004 SOLVER

    Hey,

    I have a macro in the last of my spreadsheets which just won't work. It's a macro which supposedly should be able to solve the Max DB by changing price(pris).
    The name of the spreadsheet is "Samlet Uddata". The button is just named Solver so you know which one I mean. The data in the belonging cells is from the spreadsheet beregningsark opg. 3. The object is to maximize profit but the macro won't do it. Any suggestions as to what to do? I have attatched the spreadsheet.

    // Peter
    Attached Files Attached Files
    Last edited by pede; 06-18-2013 at 12:25 PM.

  2. #2
    Forum Expert
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2003, Excel 2007 & reluctant Excel 2010 user
    Posts
    4,301

    Re: Run time error 1004 SOLVER

    Since the macro button is assigned to macro1 that only contains the command
    Please Login or Register  to view this content.
    and no solver setting i.e. "Target cell", value of "Target cell", cells to change and Solver model you get the "Run time 1004" error.

    If you set up the macro like the Solver1 macro it will work.

    Alf

    Ps Even if you are posting in an non Danish forum macro names like Solverpik and Solverlorteluder can be understood by some members and will give offence and you may be banned by forum admin.

  3. #3
    Registered User
    Join Date
    02-28-2013
    Location
    denmark
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: Run time error 1004 SOLVER

    The problem is that I need to hide the spreadsheet which is called beregningsark opg. 3, and still be able to use the solver button in the Samlet Uddata. If I set up my macro like solver 1 it doesn't work when I hide beregningsark opg. 3.

    I have given it a new try and this is the result:IT og Øko eksamen(Færdig) (1) wubi.xlsm

  4. #4
    Forum Expert
    Join Date
    03-13-2004
    Location
    Gothenburg/Stockholm, Sweden
    MS-Off Ver
    Excel 2003, Excel 2007 & reluctant Excel 2010 user
    Posts
    4,301

    Re: Run time error 1004 SOLVER

    hide the spreadsheet which is called beregningsark opg. 3, and still be able to use the solver button in the Samlet Uddata
    First of all, the way solver is set up this will not work as you found out. Extract from the solver home page:

    By Changing Cells must be on the active sheet.

    A limitation of the Solver is that all of the decision variables (adjustable or changing cells) in the By Changing Cells edit box must be cells on the active sheet. (This limitation makes the Solver considerably faster than if adjustable cells were allowed to be on any sheet.) You should re-design your Solver model so that all decision variables are on one sheet, and try again.
    What you could do is writing a macro that starts by "freezing" the screen using
    Please Login or Register  to view this content.
    then the macro should activate the hidden sheet and run solver using the command
    Please Login or Register  to view this content.
    then copy this result to another sheet and hide sheet " beregningsark opg. 3" and finally "un freeze" the screen with command
    Please Login or Register  to view this content.
    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1