ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Find Merged-cells (https://www.excelbanter.com/excel-programming/427920-find-merged-cells.html)

CLR

Find Merged-cells
 
Hi All.......
The F5-Goto feature works well for what it does. It does not allow finding
of MergedCells.......Is it possible to do this by code?......either
highlighting or changing the background color.....and then maybe being able
to reverse them back to the previous colors?

TIA
Vaya con Dios,
Chuck, CABGx3



Gary''s Student

Find Merged-cells
 
This will find and color all merged cells:

Sub FindMerge()
Dim rsel As Range, r As Range
Set rsel = Nothing
For Each r In ActiveSheet.UsedRange
If r.MergeCells = True Then
If rsel Is Nothing Then
Set rsel = r
Else
Set rsel = Union(rsel, r)
End If
End If
Next

If rsel Is Nothing Then
Else
rsel.Interior.ColorIndex = 3
End If
End Sub

--
Gary''s Student - gsnu2007L


"CLR" wrote:

Hi All.......
The F5-Goto feature works well for what it does. It does not allow finding
of MergedCells.......Is it possible to do this by code?......either
highlighting or changing the background color.....and then maybe being able
to reverse them back to the previous colors?

TIA
Vaya con Dios,
Chuck, CABGx3




CLR

Find Merged-cells
 
OUTSTANDING!!!.........that will do me just fine......thank you very much
Gary"s Student.

Vaya con Dios,
Chuck, CABGx3


"Gary''s Student" wrote in message
...
This will find and color all merged cells:

Sub FindMerge()
Dim rsel As Range, r As Range
Set rsel = Nothing
For Each r In ActiveSheet.UsedRange
If r.MergeCells = True Then
If rsel Is Nothing Then
Set rsel = r
Else
Set rsel = Union(rsel, r)
End If
End If
Next

If rsel Is Nothing Then
Else
rsel.Interior.ColorIndex = 3
End If
End Sub

--
Gary''s Student - gsnu2007L


"CLR" wrote:

Hi All.......
The F5-Goto feature works well for what it does. It does not allow
finding
of MergedCells.......Is it possible to do this by code?......either
highlighting or changing the background color.....and then maybe being
able
to reverse them back to the previous colors?

TIA
Vaya con Dios,
Chuck, CABGx3







All times are GMT +1. The time now is 07:44 PM.

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