+ Reply to Thread
Results 1 to 4 of 4

VBA Code works by step by step, doesn't work by running

  1. #1
    Registered User
    Join Date
    01-30-2014
    Location
    Brazil
    MS-Off Ver
    Excel 2016
    Posts
    46

    Question VBA Code works by step by step, doesn't work by running

    Hello.

    I'm configuring and activating OpenSolver on VBA.
    I have a code that sets the objective function cell and the decision variables iteratively for 30 sheets.
    If I run the code, it works for the first sheet, then it displays an error saying that the decision variables must be on the active sheet.
    If I place some stops at the code and run it one F8 at a time, it runs the entire code without errors.
    This seems really odd, any ideas why it's happening?

    Thanks for the attention.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA Code works by step by step, doesn't work by running

    Can you post the current code?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-30-2014
    Location
    Brazil
    MS-Off Ver
    Excel 2016
    Posts
    46

    Re: VBA Code works by step by step, doesn't work by running

    This is the part the it highlights when displaying the error:

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: VBA Code works by step by step, doesn't work by running

    I think you need to upload the file with your model and code after removing sensitive information so one can try testing a bit.

    an error saying that the decision variables must be on the active sheet.
    this is the way the Excel solver is set i.e. all variables must be on the active sheet but as you say and I agree it is strange that it works when you step through your code using F8.

    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA Step Into works as desired but running macro doesn't
    By smit.etha in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-16-2015, 07:47 PM
  2. VBA Code works with step (f8) not run <ctrl>f8
    By rmacia in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2013, 02:26 PM
  3. [SOLVED] preventing simple zoom macro from running step by step
    By reece1984 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2012, 06:13 AM
  4. shortcut key to see a macro running "step by step"
    By al007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2005, 06:25 PM
  5. [SOLVED] running macro step by step different from normal run??
    By Rinze Smit in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-26-2005, 11:05 AM
  6. My VBA code works in the step though mode but not at full speed
    By Kelly in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-15-2005, 10:06 PM

Tags for this Thread

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