+ Reply to Thread
Results 1 to 5 of 5

Loop through list on one sheet and return corresponding values from another sheet

  1. #1
    Registered User
    Join Date
    11-01-2006
    Posts
    18

    Loop through list on one sheet and return corresponding values from another sheet

    I need to write a script that can loop through a list of materials on a sheet called "InventoryHealth", beginning at cell A3 and continuing down through cell A200 (or until a blank cell is reached) and for each material listed, perform a lookup to another sheet called "PastedPivotData" to a material list beginning in columnC, and return the inventory qty values from column E (same table) into the next available blank cell (to the right of the part number) in the first sheet. Each week, another column in sheet "InventoryHealth" is to be populated using this script. Manually pasting the data may cause problems if the two lists don't line up exactly from week to week, and built-in VLookups won't necessarily work because the data from prior weeks must remain static. Only the latest weekly data needs to be populated (see example image of the cells to be populated).

    Some background: The weekly table is meant to illustrate the current and past health of inventory for selected items through the use of conditional formatting based on target and minimum safety stock levels for each part number. I just need a way to automatically populate the weekly values based on the most recent downloaded data in the "PastedPivotData" sheet. Would anyone take a stab at how this code would work? Once I have an idea as to how it will work, I could modify the code to work with some other sheets for different mfg plants. Thanks for any suggestions!

    InventoryHealth.gif
    Last edited by xlwho; 10-04-2012 at 04:13 PM.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,448

    Re: Loop through list on one sheet and return corresponding values from another sheet

    Nice picture !

  3. #3
    Registered User
    Join Date
    11-01-2006
    Posts
    18

    Re: Loop through list on one sheet and return corresponding values from another sheet

    Wow...lots of daily posts in this forum. Bumping to keep visible, maybe someone can take a look? Thanks!

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Loop through list on one sheet and return corresponding values from another sheet

    I think you are more likely to get help if you attach a sample with a desired result. You probably did not see the unwitty message from Pepe

  5. #5
    Registered User
    Join Date
    11-01-2006
    Posts
    18

    Re: Loop through list on one sheet and return corresponding values from another sheet

    Well, I decided to start from scratch and create a blank workbook with sheet1 and sheet2 and see if I could steal/modify some looping code to see if I could get the logic into some rough newbie code. I made a simple table on both sheets where sheet 1 has the item list and expanding qty columns and sheet2 has the lookup list with the pasted inv values to be carried over. It appears that it works correctly in this basic format, so I should be able to apply it to the existing file with a few modifications. Here is the basic code that seems to work, though it is probably not as clean as it should be:

    Please Login or Register  to view this content.

+ 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