Hi All
I currently have a loop, what this does is a row is entered next to the cells that need merging - it counts the amount of entries, then it puts a number in where a staff ID has been duplicated - depending on how many times it has been duplicated.
This is what it's currently doing:
Range("V2").Select
ActiveCell.FormulaR1C1 = "=SUM(R[1]C:R[1048545]C)"
Do
Application.DisplayAlerts = False
Range("V2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 1).Select
Range(ActiveCell, ActiveCell.Offset(1, 0)).Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Range("V2").Select
Selection.End(xlDown).Select
Range(ActiveCell, ActiveCell.Offset(1, 0)).Select
Selection.ClearContents
Loop Until Range("V2") = 0
so its got a formula at the top ading up the row, when it merges a cell, it removes the number, and when the top reaches zero the loop stops.
I have a couple of problems and I wanted to see if anyone can help.
1) On a few occasions there is more than 1 duplicate row for a person - is there a way for the merge to select the cells to merge dependent on the cell value? So, if the formula next to the cell has detected there are 5 rows matched, it selects the one to the right, and the 4 below to be merged?
2) The cells to the right of the formula (as per the loop above) are not the only ones that need to be merged. I also need to do the 20 odd ones next to it - is there another way to do this rather than repeating the loop another 20 times, but moving it along one each time?
Thanks in advance guys
Bookmarks