+ Reply to Thread
Results 1 to 10 of 10

lookup_value in For-loop not updating

  1. #1
    Registered User
    Join Date
    12-04-2016
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    6

    lookup_value in For-loop not updating

    In the For-loop below the lookup_value in the Vlookup formulas are not updating. That is, the values of Forecast, wForecast and wDemand do not change after subsequent iterations of (i).

    I have a msgbox to debug and see what ForecastYear is at the beginning of each iteration of the For-loop. It updates normally from 2016.1 through to 2016.4

    Then, I tried copying out the code 4 times, removing the For-Loop completely, and changed the ForecastYear manually in each instance. It works perfectly.

    So I can fall back on that, but it still doesn't explain the problem with the vlookups not recognizing the change in the variable.

    Thank you for any help on the matter.

    Please Login or Register  to view this content.
    Last edited by AliGW; 12-04-2016 at 09:35 AM. Reason: Correctly marked as solved.

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: lookup_value in For-loop not updating

    Would be better if you can upload the workbook so we can look and debug your problem
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Registered User
    Join Date
    12-04-2016
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    6

    Re: lookup_value in For-loop not updating

    I can't see a way to upload the workbook. This is a link to the workbook on my dropbox.

    https://www.dropbox.com/s/64m1dl6av3...v1.4.xlsm?dl=0

  4. #4
    Registered User
    Join Date
    12-04-2016
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    6

    Re: lookup_value in For-loop not updating

    Trying to upload:
    The Code is in the Userform called PredictionMain
    Attached Files Attached Files

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: lookup_value in For-loop not updating

    ok give me the process of what your issue is. I open the userform and I am stuck in a loop asking for product code?

  6. #6
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: lookup_value in For-loop not updating

    Give this a try. If the returned results are wrong change the columns highlighted in Red.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    12-04-2016
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    6

    Re: lookup_value in For-loop not updating

    It worked!! Thank you!

    I've been searching for a fix for this for days.

  8. #8
    Registered User
    Join Date
    12-04-2016
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    6

    Re: lookup_value in For-loop not updating

    It worked! Thank you so much, I've been trying to solve this for days!

  9. #9
    Registered User
    Join Date
    12-04-2016
    Location
    Brisbane, Australia
    MS-Off Ver
    2010
    Posts
    6

    Re: lookup_value in For-loop not updating

    I just added to your rep

  10. #10
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: lookup_value in For-loop not updating

    Thanks for the Rep, Please mark the thread as solved.

+ 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. 2 lookup_Value for Vlookup
    By bryceismad1 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-29-2014, 02:06 PM
  2. updating find and replace values in a macro loop
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-10-2013, 03:25 AM
  3. lookup_value in VLOOKUP formula
    By 99f150 in forum Excel General
    Replies: 7
    Last Post: 03-16-2010, 11:21 AM
  4. Selection not updating after 1st iteration in a For Each loop
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2009, 09:19 PM
  5. Lookup_value and Concatenate
    By gagood in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-13-2007, 06:59 PM
  6. updating range of a loop
    By Ouka in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-25-2006, 04:51 PM
  7. [SOLVED] multiple lookup_value
    By Inter in forum Excel General
    Replies: 12
    Last Post: 04-13-2006, 05:10 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