Results 1 to 5 of 5

Merging & multiplying cells

Threaded View

  1. #1
    Registered User
    Join Date
    03-21-2012
    Location
    Romania
    MS-Off Ver
    2010
    Posts
    23

    Merging & multiplying cells

    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!
    Attached Files Attached Files
    Last edited by adygelber; 10-12-2012 at 10:54 AM. Reason: error in attachment

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1