Macro for merging rows
Hello Wouter,
I have tried your program and think that the fifth line of:
loopRow=ActiveCell.Row
should be replaced with:
loopRow=2
Best Regards,
Gabor Sebo
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
"Wouter HM" wrote in message
...
Hi rsklhm
Using Excel 2003 I have created this:
Sub MergeOnColumnA()
Dim lastRow As Long
Dim loopRow As Long
lastRow = Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row + 1
loopRow = ActiveCell.Row
Do While loopRow < lastRow
Cells(loopRow, 1).Select
If Cells(loopRow, 1).Value = Cells(loopRow - 1, 1).Value Then
Cells(loopRow - 1, 1).End(xlToRight).Offset(0, 1).Value = _
Cells(loopRow, 2)
Cells(loopRow - 1, 1).End(xlToRight).Offset(0, 1).Value = _
Cells(loopRow, 3)
Rows(loopRow).Delete
lastRow = lastRow - 1
Else
loopRow = loopRow + 1
End If
Loop
End Sub
HTH,
Wouter
|