Consulting

Results 1 to 5 of 5

Thread: Solved: merge blank record in first column

  1. #1
    VBAX Regular
    Joined
    Apr 2012
    Posts
    22
    Location

    Solved: merge blank record in first column

    In the excel sheet, I want to merge all blank record for column A. Last row word should always be in bold letter and the row will be in "all borders" until it encounter any word
    Please note that rows are in dynamic range
    In the attached sheet, I want output to be in "sheet2" from "sheet1"
    Attached Files Attached Files

  2. #2
    VBAX Regular
    Joined
    Apr 2012
    Posts
    22
    Location
    Whenever I am doing merging for some rows using macro recording, I am getting output like this. How can I do for all records.

    Please run the macro inside excel for your reference
    Attached Files Attached Files

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [VBA]Sub ProcessData()
    Dim cell As Range
    Dim lastrow As Long
    Dim startrow As Long
    Dim i As Long

    With ActiveSheet

    lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
    For i = 3 To lastrow - 1

    startrow = i
    Do Until .Cells(i, "A").Interior.ColorIndex = 48

    i = i + 1
    Loop

    With .Cells(startrow, "A").Resize(i - startrow)

    .Merge
    .HorizontalAlignment = xlLeft
    .VerticalAlignment = xlTop
    End With
    Next i

    .Rows(i).Font.Bold = True
    End With
    End Sub
    [/VBA]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    VBAX Regular
    Joined
    Apr 2012
    Posts
    22
    Location
    Thanks Cruise for your great help.
    But the last row is not getting "All bordered"where "Grand total" is there, Could you please check

    Advance many many thanks
    Attached Files Attached Files

  5. #5
    VBAX Regular
    Joined
    Apr 2012
    Posts
    22
    Location
    Thanks Xld, I am getting output. Sorry to trouble you. I forgot to tell you one thing. In that sheet, whereever I will encounter the word "total", I want to put that row as "all bordered". Please help me

Posting Permissions

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