+ Reply to Thread
Results 1 to 3 of 3

MErge everything all colums into one

  1. #1
    Shan
    Guest

    MErge everything all colums into one

    I have a worksheet with many columns. I want to take the content of all
    the columns and put it in just one column , lets say A. How can i go
    about doing this?


  2. #2

    Merge columns into one column

    I'm fairly new at this and it's a steep learning curve - there are no
    doubt more elegent ways to do this.. but if you have a limited number
    of columns that you need to work with and you know the columns in
    advance, this will do the trick...

    =======================================================
    Sub merge()
    Dim somestring As String
    Dim somestring2 As String
    Dim somestring3 As String
    Dim mergedstring As String

    somestring = Range("b1").Value
    somestring2 = Range("c1").Value
    somestring3 = Range("d1").Value

    mergedstring = somestring & " " & somestring2 & " " & somestring3
    Range("a1").Value = mergedstring

    End Sub

    =======================================================

    HTH

    Gary


  3. #3
    Valued Forum Contributor Excelenator's Avatar
    Join Date
    07-25-2006
    Location
    Wantagh, NY
    Posts
    333
    In Cell A2 put the formula:

    =B2 & C2 & D2 & E2 ..... etc.

    and all the data will be concatenated. If you want some delimiter you can use this formula:

    =B2 & "," & C2 & "," & D2 & "," & E2 ..... etc.

    Then copy that formula down for the number of rows you have. If you want it then to be values copy Column A and Paste Special Values in Column A.





    Quote Originally Posted by Shan
    I have a worksheet with many columns. I want to take the content of all
    the columns and put it in just one column , lets say A. How can i go
    about doing this?
    ---------------------------------------------------
    ONLY APPLIES TO VBA RESPONSES WHERE APPROPRIATE
    To insert code into the VBE (Visual Basic Editor)
    1. Copy the code.
    2. Open workbook to paste code into.
    3. Right click any worksheet tab, select View Code
    4. VBE (Visual Basic Editor) opens to that sheets object
    5. You may change to another sheets object or the This Workbook object by double clicking it in the Project window
    6. In the blank space below the word "General" paste the copied code.

+ 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