• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

i want vba code for finding the number of merged cells in a particular column

madhavi

New Member
i want to find the number of merged blocks in column 1 before I encounter a text(report) in that column 1 . can any one please help me
 
[pre]
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<<<< change to suit
Dim Lastrow As Long
Dim cnt As Long
Dim i As Long

Application.ScreenUpdating = False

With ActiveSheet

Lastrow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To Lastrow 'Lastrow to 1 Step -1

If .Cells(i, "A").MergeCells Then

cnt = cnt + 1
End If
Next i
End With

MsgBox cnt

Application.ScreenUpdating = True
End Sub
[/pre]
 
Back
Top