PDA

View Full Version : [SOLVED] How to find the first and last row of merge Cells???



sankartalam
07-15-2008, 02:57 AM
Hi all,
Could you please help me!!! How to find the starting row and ending row of merge cells using the vbscript.

Suppose if i have merged B1 to B9 my output should be
Starting row of merge cells is "1"
Ending row of merge cells is "9"








Thanks InAdvance!!!
Sankar

Bob Phillips
07-15-2008, 03:44 AM
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If cell.MergeCells Then
If cell.Address = cell.MergeArea.Cells(1, 1).Address Then
MsgBox "Starts in: " & cell.Row & vbNewLine & _
"Ends in: " & cell.MergeArea(cell.MergeArea.Count).Row
End If
End If
Next cell

sankartalam
07-15-2008, 04:54 AM
Thanks alot Xld...

jack nt
09-13-2010, 07:14 AM
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If cell.MergeCells Then
If cell.Address = cell.MergeArea.Cells(1, 1).Address Then
MsgBox "Starts in: " & cell.Row & vbNewLine & _
"Ends in: " & cell.MergeArea(cell.MergeArea.Count).Row
End If
End If
Next cell


Thank xld very much!