ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Cell pattern (https://www.excelbanter.com/excel-discussion-misc-queries/79268-re-cell-pattern.html)

Gary''s Student

Cell pattern
 
You can write VBA to scan a set of cells and select only those with a given
property:

Sub red_find()
Dim r, rr As Range

For Each r In Selection
If r.Interior.ColorIndex = 3 Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next

If rr Is Nothing Then
Else
rr.Select
End If
End Sub

will select all cells in the selected region with background color red.

Use this and immortality is yours (almost)
--
Gary's Student


"BBlue" wrote:

Is there an instruction that allows me to only select cells with the same
pattern? For example, cells with the same font color or cells with the same
fill color, regardless of the content of the cell.
--
I don''t want to achieve immortality through my work. I want to achieve it
through not dying.



All times are GMT +1. The time now is 10:06 PM.

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