Find range of merged cells

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like a macro that can search one cell say "A1" and check if the cell
is merged.

If the cell is merged then return all cells merged with "A1"

Thanks
 
Something like this:

Public Function MergedCells(WhichRange As Range) As Variant

With WhichRange
If .MergeCells = False Then
MergedCells = False
Else
MergedCells = .MergeArea.Address
End If
End With

End Function

NickHK
 
Cheers Nick just what I was looking for

NickHK said:
Something like this:

Public Function MergedCells(WhichRange As Range) As Variant

With WhichRange
If .MergeCells = False Then
MergedCells = False
Else
MergedCells = .MergeArea.Address
End If
End With

End Function

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top