ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Merged Cells (https://www.excelbanter.com/excel-discussion-misc-queries/30540-merged-cells.html)

TerryTutor

Merged Cells
 
Is there some way to find which cells are merged without having to look at
each cell? Sometimes I want to move or delete cells and it says" cannot move
part of merged cell" or something like that, but it does not show me which
cell is merged.


Norman Jones

Hi Terry,

I am not aware of any inbuilt method for displaying merged cells.

One possibility would be to use a macro like the following which will select
(and therefore temporarily highlight) merged cells. As written, the macro
will select all merged cells in the selected range. If the selection
comprises a single cell, all merged cells will be selected. If no merged
cells are found, a message will put up to confirm this.

Sub ShowMergedCells()
Dim rng As Range
Dim rCell As Range
Dim RngMerged As Range

If Selection.Count 1 Then
Set rng = Selection
Else
Set rng = Selection.Parent.UsedRange
End If

For Each rCell In rng

If rCell.MergeCells Then
If Not RngMerged Is Nothing Then
Set RngMerged = Union(RngMerged, rCell)
Else
Set RngMerged = rCell
End If
End If
Next

If Not RngMerged Is Nothing Then
RngMerged.Select
Else
MsgBox "No merged cells found in selected range!"
End If

End Sub

You could perhaps assign the macro to a toolbar button.

If you are new to macros, visit David McRitchie's introductory notes at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

---
Regards,
Norman



"TerryTutor" wrote in message
...
Is there some way to find which cells are merged without having to look at
each cell? Sometimes I want to move or delete cells and it says" cannot
move
part of merged cell" or something like that, but it does not show me which
cell is merged.





All times are GMT +1. The time now is 07:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com