Finding duplicates and merging them
Eliminate Pivot Table Annoyances
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Finding duplicates and merging them

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Milwaukee, WI
    Posts
    105
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I have a column where many of the names will be repeated consecutively (after sorting). I want to use VBA to find a set of replicates and merge them into one cell. Any idea?

  2. #2
    Board Regular
    Join Date
    Feb 2002
    Location
    Perth Australia
    Posts
    1,579
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi jrnyman

    You could try this code in a macro:

    Application.DisplayAlerts = False
    For Each Cell In Selection
    If ActiveCell.Offset(1, 0).Value = ActiveCell.Value Then
    Range(ActiveCell, ActiveCell.Offset(1, 0)).Merge
    Else
    ActiveCell.Offset(1, 0).Select
    End If
    Next
    End Sub

    This seems to do what you want, but test it out first. Be careful because it will merge blank cells if they are in your selection. Particularly make sure the last cell in your selection is not blank (or it will merge right down the column). Don't forget you can't use the undo button with a macro.

    Hope this helps
    regards
    Derek



    [ This Message was edited by: Derek on 2002-03-13 06:00 ]

  3. #3
    Board Regular
    Join Date
    Jun 2014
    Posts
    122
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Finding duplicates and merging them

      
    is there any way yo put range on it so it only goes from row 4-19 Column A

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com