+ Reply to Thread
Results 1 to 4 of 4

Loop through numbers separated by comma in a single cell

  1. #1
    Registered User
    Join Date
    06-13-2016
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    95

    Loop through numbers separated by comma in a single cell

    Hi ,

    If i have a cell with numerical values separated by commas, how can I loop through the numerical values and have a variable numsearch = to each number during the course of hte loop?

    Ie follows the logic of:
    For number in cell
    numsearch = number
    . rest of the code goes here
    . rest of the code goes here
    . rest of the code goes here
    . rest of the code goes here
    next number

    Things to note, all numbers are 5 digits in length only.
    Example of possible cell values:
    12345
    12345,23452,25235
    12515,25255

    So the loop would go through as many possible numbers as exist in that cell and perform whatever the code needs to do with that number. Then go to the next num (separated by comma) etc

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Loop through numbers separated by comma in a single cell

    To give you an idea.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Registered User
    Join Date
    06-13-2016
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    95

    Re: Loop through numbers separated by comma in a single cell

    Works exactly how i wanted, thanks a lot!

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Loop through numbers separated by comma in a single cell

    You're welcome and thanks for rep+.

+ 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. Lowest number in comma separated list from a single cell
    By jwrobel in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 03-30-2017, 03:27 AM
  2. Selecting Lowest Number from Data in a Single Cell Separated by Comma
    By hasanrazaque in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-07-2016, 12:13 AM
  3. Replies: 2
    Last Post: 12-07-2015, 09:04 PM
  4. [SOLVED] Using comma separated values in a single cell
    By joerobb in forum Excel General
    Replies: 7
    Last Post: 01-16-2015, 08:45 AM
  5. Match a Value from a single-cell, comma separated list
    By secondchild12 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-24-2014, 06:16 PM
  6. Macro to create a list of sheets, separated with comma in a single cell
    By manolomana in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-30-2014, 11:00 AM
  7. Column/cells to single cell comma separated data?
    By egeorge4 in forum Excel General
    Replies: 1
    Last Post: 04-27-2007, 03:53 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