Consulting

Results 1 to 3 of 3

Thread: Placing comma separated values into the corresponding cell

  1. #1
    VBAX Regular
    Joined
    Aug 2017
    Posts
    57
    Location

    Question Placing comma separated values into the corresponding cell

    I have comma separated values like (1,2,3 or 10,50,60,70 etc..) in Column A, and in Column B, in the corresponding cells there are cell locations like C10, C15,C40,C100 etc..
    I need a way to place the values in Column A into the corresponding Cell location in Column B. Column A is the source of Data (comma separated values), and Column B is the location of the data. Column C is where the data will be placed. Column A and Column B have data without spaces, however there will be spaces ( empty cells) in Column C when all data is placed. There aren't enough data to fill all the cells in Column C. Is there way to do this with a formula or VBA? please. Thanks. It will look something like this:


    A B C
    1,2,3 C2
    4,5,6 C5 1,2,3
    7,8,9,10 C7
    11,12,13 C9
    .....etc ..etc 4,5,6
    7,8,9,10
    11,12,13

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,726
    Location
    VBA, and no error checking

    Option Explicit
    
    Sub PutData()
        Dim r As Long, n As Long
        
        With ActiveSheet
            n = .Cells(1, 1).CurrentRegion.Rows.Count
            For r = 1 To n
                Range(.Cells(r, 2).Value).Value = .Cells(r, 1).Value
            Next r
        End With
    End Sub
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Regular
    Joined
    Aug 2017
    Posts
    57
    Location
    Thanks a lot, Paul! This works perfectly. I didn't have any issues. Have a great day!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •