hunsnowboard
04-20-2012, 06:25 AM
Hi Everyone. I would like to get some help for a macro. Here is my problem. I have an excel file with many recurring rows. Actually not all the cells in the row are duplicates only the first 3. The cells after them are different. What I would like is the following: instead of three rows to have only one and the cells which are not identical to be joined/merged into one cell. In the attached excel file you will see exactly what I mean.
Please try to help me as this problem is killing me! :banghead: Thank you and best regards!
Bob Phillips
04-20-2012, 06:41 AM
Sub ProcessData()
Dim lastrow As Long
Dim i As Long
Application.ScreenUpdating = False
With ActiveSheet
lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = lastrow To 3 Step -1
If .Cells(i, "A").Value = .Cells(i - 1, "A").Value And _
.Cells(i, "B").Value = .Cells(i - 1, "B").Value And _
.Cells(i, "C").Value = .Cells(i - 1, "C").Value Then
.Cells(i - 1, "D").Value = .Cells(i - 1, "D").Value & ";" & _
.Cells(i, "D").Value
.Cells(i - 1, "E").Value = .Cells(i - 1, "E").Value & ";" & _
.Cells(i, "E").Value
.Cells(i - 1, "F").Value = .Cells(i - 1, "F").Value & ";" & _
.Cells(i, "F").Value
.Rows(i).Delete
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
hunsnowboard
04-20-2012, 07:03 AM
Thank you very much xld! It works like charm! :)
Thank you very much!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.