Solved

Excel Macro to combine cells if duplicate

Posted on 2016-09-14
2
41 Views
Last Modified: 2016-09-14
Hello,
can you please help with an Excel  Sub.,
if rows are the same (Column A,B,C,D,E), THEN combine Cells in Column F (remove NO.) , separated by comma.
and Delete rows.

Attached is a sample,
Your help is very much appreciated.

thanks,
sample.xlsx
0
Comment
Question by:W.E.B
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 50

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 41797890
Hi,

pls try
Sub macro1()

For Idx = Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
    Set c = Range("A" & Idx)
    If c = c.Offset(-1) And c.Offset(, 1) = c.Offset(-1, 1) And _
            c.Offset(, 2) = c.Offset(-1, 2) And c.Offset(, 3) = c.Offset(-1, 3) And _
            c.Offset(, 4) = c.Offset(-1, 4) Then
        c.Offset(-1, 5) = c.Offset(-1, 5) & ", " & Right(c.Offset(, 5), Len(c.Offset(, 5)) - 4)
        c.EntireRow.Delete
    End If
    
Next
End Sub

Open in new window

Regards
0
 

Author Closing Comment

by:W.E.B
ID: 41797904
Thank you very much,
worked like a treat.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Modify to work without control shift enter 9 35
Set a Range to a Cell in Excel VBA 2 15
Excel Formula 6 25
Pivot Table Help 6 15
Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question