+ Reply to Thread
Results 1 to 2 of 2

VB to gather mulitiple values from a cell that is soft returned

  1. #1
    Registered User
    Join Date
    05-08-2010
    Location
    Minneapolis, MN
    MS-Off Ver
    2010
    Posts
    3

    VB to gather mulitiple values from a cell that is soft returned

    A macro I'm writing needs to gather values from a column and put them in a new sheet; however, many of the cells in the column have several values in a cell, separated by a soft return.

    I need it to put each value of the soft-returned cell into its own row in the new spreadsheet.

    How do I program for VB to copy the first value in the cell and then during the next pass to take the second value in the cell? Or is there a way to split it in the new sheet?

    Thanks!

  2. #2
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: VB to gather mulitiple values from a cell that is soft returned

    Define a new variable of type Variant and a loop variable. For each cell use Split, with Chr(10) as the delimiter, to split the cell into an array containing each value separately and then loop through those values.

    Here's a quick example, running through cells A1:A10 and popping up a message box for each individual value in each of those cells.

    Please Login or Register  to view this content.
    Last edited by Andrew-R; 12-24-2012 at 12:16 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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