+ Reply to Thread
Results 1 to 18 of 18

Combining data from two columns

Hybrid View

  1. #1
    dziw
    Guest
    Thanks, but I wasn't clear. Each column is a separate category of names, so I'm not combining each cell (i.e. first & last), but am making a new longer column combining all the names from each column.

  2. #2
    PCLIVE
    Guest

    Re: Combining data from two columns

    Here's some code you might be able to use.



    Range("A1:" & Range("A65536").End(xlUp).Address).Select
    Selection.Copy

    Range("C1").Select
    ActiveSheet.Paste

    Range("B1:" & Range("B65536").End(xlUp).Address).Select
    Selection.Copy

    Range("C65536").End(xlUp).Select
    ActiveSheet.Paste

    'If you want to remove duplicate names or entries, use this code
    ' This function must sort first.
    Range("C1:" & (Range("C65536").End(xlUp).Address)).Select
    Selection.Sort Key1:=Range("C1"), Order1:=xlAscending,
    Header:=xlNo, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
    ColNum = Selection(1).Column
    For RowNdx = Selection(Selection.Cells.Count).Row To _
    Selection(1).Row + 1 Step -1
    If Cells(RowNdx, ColNum).Value = Cells(RowNdx - 1, ColNum).Value
    Then
    Cells(RowNdx, ColNum).Value = ""
    End If
    Next RowNdx

    Selection.Sort Key1:=Range("C1"), Order1:=xlAscending, Header:=xlNo, _
    OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom

    'End Remove Duplicates



    If you want it to update when the worksheet is changed, right-click on that
    worksheet and select View code.
    Click General dropdown and select Worksheet. Click other dropdown and
    select Change. Then enter the code above.

    HTH,
    Paul





    "dziw" <dziw.2bxdjs_1154543106.9206@excelforum-nospam.com> wrote in message
    news:dziw.2bxdjs_1154543106.9206@excelforum-nospam.com...
    >
    > Thanks, but I wasn't clear. Each column is a separate category of names,
    > so I'm not combining each cell (i.e. first & last), but am making a new
    > longer column combining all the names from each column.
    >
    >
    > --
    > dziw
    > ------------------------------------------------------------------------
    > dziw's Profile:
    > http://www.excelforum.com/member.php...o&userid=10422
    > View this thread: http://www.excelforum.com/showthread...hreadid=567563
    >




+ 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