+ Reply to Thread
Results 1 to 6 of 6

Simple loop macro?

  1. #1
    Registered User
    Join Date
    07-28-2009
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2003
    Posts
    28

    Simple loop macro?

    Hello!

    I'm hoping to improve a model in a very specific way: adding an iterative loop. Here's the four things I'd like it to do:
    1. model updates cell H2 (starts at 1, goes to n) [n, the total number of loops required is defined by the value this cell:]
    2. model refreshes this tab and then all formulas in all tabs between 1 and 2 in the workbook
    3. model then refreshes specific tabs in this order (excluding tables): Calculation, Adjustments, Scenario
    4. the fixed output range in adjustments is copied and pasted below after each loop until all loops are run.

    Thank you in advance for your help!

    M
    Attached Files Attached Files
    Last edited by mscott123; 03-25-2019 at 05:32 AM.

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Simple loop macro?

    I think I was able to follow the instructions

    I couldn't really test it since the numbers seemed to have reached equilibrium, so they are not changing.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    07-28-2009
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Simple loop macro?

    dflak, this is exactly the help I needed. Thank you so much for making the code so clear.
    Much appreciated!!!
    m

    sorry for ruining the incomplete formula!

  4. #4
    Registered User
    Join Date
    07-28-2009
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Simple loop macro?

    Is it too late to ask, how would I modify the code to update cell H2 each time for each k, ending at the total number in H3?
    Thank you!

    M

  5. #5
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Simple loop macro?

    I think I understand the requirement. For the first loop, K2 = 1, next loop K2 = 2, etc. I think this code will do that.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-28-2009
    Location
    Stavanger, Norway
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Simple loop macro?

    Perfect! Thanks dflak! lifesaver...

+ 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. Loop for Simple Macro Not Working as Expected
    By Yerda579 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-14-2019, 10:59 AM
  2. [SOLVED] A simple loop
    By kbka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2012, 01:21 PM
  3. [SOLVED] Simple VBA loop macro
    By pivotpd in forum Excel General
    Replies: 5
    Last Post: 07-16-2012, 05:44 AM
  4. Simple loop macro needed
    By Gillman in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-01-2010, 01:05 PM
  5. Simple Loop Help Please
    By HBF in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2006, 09:34 AM
  6. [SOLVED] Simple loop in macro
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-12-2006, 05:40 AM
  7. [SOLVED] Simple loop?
    By bushtor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-13-2005, 11:05 AM

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