View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How do I locate merged cells

Is a macro ok?

Option Explicit
Sub testme()

Dim rptWks As Worksheet
Dim wks As Worksheet
Dim oRow As Long
Dim iCtr As Long
Dim myCell As Range

Set wks = Worksheets("sheet1")

Set rptWks = Worksheets.Add
rptWks.Range("a1").Value = wks.Name

oRow = 1
For Each myCell In wks.UsedRange.Cells
If myCell.MergeArea.Cells.Count 1 Then
If myCell.MergeArea.Cells(1).Address = myCell.Address Then
oRow = oRow + 1
rptWks.Cells(oRow, 1).Value = myCell.MergeArea.Address
End If
End If
Next myCell

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm



jben001 wrote:

Sorry Dave should have made it a little clearer - I don't want to simply
'unmerge' the offending cells as I data will subseqently be out of line when
I subsequently sort.
Jan

"Dave Peterson" wrote:

If you want to unmerge the cells (without regard to where it is), you can select
the whole range (the entire worksheet???) and

Format|Cells|Alignment tab|uncheck Merge Cells



jben001 wrote:

I have a workbook of some 13 thousand rows - I've just tried to do a sort
only to find sort cannot function as there are 1 or more merged cells. Is
there anyway I can 'find' the merged cells rather than checking each row by
row?


--

Dave Peterson


--

Dave Peterson