Results 1 to 2 of 2

Loop: Assign value to Cell based on List

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Loop: Assign value to Cell based on List

    I'm stuck on trying to figure this out.

    I have a named range in Cell N10 that will automatically get incremented by 1 from 1 to 1000 using my current loop code, and based on the value in that cell (N10), a chart gets generated.

    So for example:
    if N10 = 1, a chart for District 1 will be generated
    if N10 = 2, a chart for District 2 will be generated
    if N10 = 900, a chart for District 900 will be generated
    etc.
    etc.

    As you can imagine, based on my current code, this will happen until I hit District 1000.

    The problem however is, that we do not have 1000 districts, as we skip several numbers in between 1-1000.
    This is where things can get sloppy as the next step in my code is to upload these files to a server, resulting in hundreds of junk districts that simply do not exist (charts will appear as blank).

    However, I've created a separate column, Z, that has a list of all the specific districts.

    Where I'm stuck though, is I'm not quite certain how to:
    1. Assign a value from Column Z to N10 (starting from whatever District value is in Z2)
    2. Run my Macro to generate the chart
    3. Loop to the next value in column Z, Z3, assign it to N10
    4. Run my Macro to generate the chart
    5. ...and keep repeating this process until I've hit the last value in column Z holding my actual district numbers


    Any help would be immensely appreciated!
    Last edited by hamidxa; 11-15-2013 at 01:59 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Assign Letter from list based on two conditions.
    By stockgoblin42 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-22-2013, 04:10 PM
  2. Replies: 3
    Last Post: 04-23-2013, 03:46 PM
  3. [SOLVED] VBA loop to copy a worksheet a number of times, assign name each time based on loop number
    By TBG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2012, 10:54 PM
  4. Code to loop through a column and change cell value based on list
    By davekippen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-13-2011, 04:27 PM
  5. Assign value to a string based on its position in a list
    By RobynC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2008, 05:15 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