+ Reply to Thread
Results 1 to 3 of 3

Loops with saved variables for each loop to be compared after loop is finished?

  1. #1
    Registered User
    Join Date
    05-22-2014
    Posts
    37

    Loops with saved variables for each loop to be compared after loop is finished?

    Hard to explain in the heading, but here is a more complementary version;
    I have a macro that puts values into different cells in a sheet. By doing this the sheet has lots of formulas that make other cells give a capasity/result for this situation/combination. I have a lot of combinations (this can be around 5000 rows/combinations). To do all of these combinations I have a loop from 9 (where the first combination starts) to LastRow.
    What I want is to store the variable and compera them after the loop is over, like the first variable is Variable1, next Variable 2 etc... then after the loop, I go somthing like Application.Max(Union(Variable1 to VariableLastrow))...? any ideas?

    Here are some of the code (it is much larger, but the principle is the same);

    Please Login or Register  to view this content.
    Is this even possible?
    I know I can write all the Results in a range on another sheet, and then compare the values in the range there, but my guess is that this is slowing down the macro (which takes around 4-5 minutes with the solution of writing to another sheet).

    Thanks in advance!!

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Loops with saved variables for each loop to be compared after loop is finished?

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    To add a file to a new post

    To add a file to an existing post.

  3. #3
    Registered User
    Join Date
    05-22-2014
    Posts
    37

    Re: Loops with saved variables for each loop to be compared after loop is finished?

    Ok, here is an attachment.
    It works, but I want to just show the max value without writing anything (exept the max value of course) in the sheet. The max is to be calculated in the code...
    Beregn=Calculate
    Slett Res=Delete results
    Attached Files Attached Files

+ 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. Do loop error when finished
    By Dooey123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-07-2015, 12:22 PM
  2. [SOLVED] 2 Loops. One loop within another.
    By starcraftbud in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-22-2013, 03:56 PM
  3. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  4. [SOLVED] Nested FOR loop from multiple FOR loops
    By Chilton in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 08-15-2012, 11:36 AM
  5. Not good with Loops - how to make this a loop
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2012, 03:32 PM
  6. Loops loop too much?
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-02-2010, 05:32 PM
  7. How to end loop after two loops?
    By Kryer in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-22-2005, 08:12 PM

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