+ Reply to Thread
Results 1 to 5 of 5

converting vertical value to horizontal within braces

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-21-2010
    Location
    LONDON
    MS-Off Ver
    2007
    Posts
    108

    converting vertical value to horizontal within braces

    Hi!


    I need to convert the vertical row column into a single Cell in a special format.Attached file can explain you better what I really want.


    Thanks in advance.


    Lovinguy
    Attached Files Attached Files

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: converting vertical value to horizontal within braces

    If there are not too many such entries, you can obtain it like this

    =A2&"','"&A3&"','"&A4&"','"&A5&"','"&A6&"','"&A7

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,251

    Re: converting vertical value to horizontal within braces

    Hi Lovinguy,

    You could do this manuallly with the concatinate function
    =A2&","&A3&","&A4&","&A5&","&A6&","&A7
    or use VBA Join function.
    see
    http://msdn.microsoft.com/en-us/libr...ffice.10).aspx

    If the range of your rows changes then VBA is the way to go.

    hope this helps.
    Last edited by MarvinP; 10-15-2011 at 10:46 AM.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: converting vertical value to horizontal within braces

    Hi lovinguy

    Try this
    Option Explicit
    Sub PutItTogether()
        Dim LR As Long
        Dim Rng As Range
        Dim Cell As Range
        LR = Range("A" & Rows.Count).End(xlUp).Row
        Set Rng = Range("A2:A" & LR)
        For Each Cell In Rng
            If Cell.Row = 2 Then
                Range("B2").Value = Cell.Value
            Else
                Range("B2").Value = Range("B2").Value & "','" & Cell.Value
            End If
        Next Cell
        Range("B2").Value = Range("B2").Value & "'"
    '    Range("A2:A" & LR).ClearContents
    End Sub
    If you want column A cleared uncomment this line
    '    Range("A2:A" & LR).ClearContents
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: converting vertical value to horizontal within braces

    hi, lovinguy, please check attachment, run code "test"
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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