Hello,
I want to merge some cells using a criteria. To be more specific, let's speak on the file attached.
Beginning with the P5 cell I want to merge to the right groups of 4 cells for each name from the column J. Therefore the first group of merged cells will be P5:S5, the next group will be T5:W5 and so on until reaches 11 groups of 4 cells. The last group will be BD5:BG5.
I tryied a script like this but it says that there is a syntax error on the "Else" instruction: Range(Range("AB5").End(xlToRight).Offset(0, 1), Range("AB5").End(xlToRight).Offset(0, nrCat)).Select
Dim i As Long
nrCat = Range("O2").Value
For i = 1 To nrCat
If Range("AB5") = "" Then
Range("AB5", Range("AB5").Offset(0, nrCat - 1)).Select
Range("AB5") = "A"
Selection.Merge
Else
Range(Range("AB5").End(xlToRight).Offset(0, 1), Range("AB5").End(xlToRight).Offset(0, nrCat)).Select
Selection.Merge
End If
Next iCan you help me?
Thanks!
Bookmarks