+ Reply to Thread
Results 1 to 6 of 6

Replace column values based on a list

  1. #1
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Replace column values based on a list

    Hi All,

    I am working on a project which has many parts to the code. I have the following code that works and runs as needed, here is what I am doing here.
    This code uses two tabs, "Old Data" and "New Data"

    Old Data tab is my present data and consists of for this sample 2 columns, ID numbers and holds numbers 1 to 9, and is under column A and Item under column B with a list of items.
    New Data tab is my new data list and consists of for this sample 2 columns, ID numbers and also holds numbers 1 to 9, and is under column A and Item under column B has a list of new updated items.

    So, if old data tab col A has a 1 as the ID and Item as Apple, then match new data tab col A which has a 1 as the ID and item AppleFruit. I want Apple Fruit to replace the 1 on Old Data tab so I have AppleFruit as ID and Apple as the Item.

    My question is, instead of another tab holding the new data, can I have an array holding this new data list within the code itself, or some other way to do this, the list will be small, maybe 20 items and will be added to over a period of time to reach the 20 items.

    I hope my description is clear enough

    Please Login or Register  to view this content.
    Any help will be appreciated on how to updated the code to do what I want!
    ==========
    Bigroo1958
    Austin, Texas
    ==========

  2. #2
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Re: Replace column values based on a list

    Hi,

    I just thought of this, can a select case work with a list of items??

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Replace column values based on a list

    Please Login or Register  to view this content.
    MyArray(0) will give you Apples
    MyArray(1) will give you Pears
    MyArray(3) will give you Oranges
    ubound(MyArray) will give you 3

  4. #4
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Re: Replace column values based on a list

    Thanks for the reply mehmetcik!

    I guess I don't follow you, I have two values, ID and items. Are you using the MyArray(1) for the ID as per my example?

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Replace column values based on a list

    I am demonstrating how to store variables within an array in the code.

    Then how to read the variables.

    As per your request: "Can I have an array holding this new data list within the code itself?"

  6. #6
    Forum Contributor
    Join Date
    11-27-2009
    Location
    Austin, Texas
    MS-Off Ver
    Excel 2013 & 2016
    Posts
    409

    Re: Replace column values based on a list

    Thanks mehmetcik, I appreciate the reply!

    I think I understand what you are saying. I did a little goggling and found simple examples. Could I perhaps have two set of a arrays.

    Maybe one as "Oldarray" with present values, then another one with values I want to change the old values too, "NewArray"

    How do I modify my present code to add in the arrays?

+ 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. Replies: 2
    Last Post: 10-25-2013, 07:01 PM
  2. Find a keyword and replace with list of values from a column
    By georgemathew46 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-05-2013, 10:34 AM
  3. SUMing values based on dropdown list in another column
    By IrishGuy007 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-05-2012, 05:45 AM
  4. list values in one column based upon value of another
    By DKY in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 12-13-2007, 01:42 PM
  5. Replies: 0
    Last Post: 10-13-2005, 02:05 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