Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default identify consecutive columns they are coloured

Elaine,
Try this:

Private Sub CommandButton2_Click()
Dim CompleteRows As Range

Const INDEX_RED As Long = 3

Set CompleteRows = GetCompleteColouredRows(Range("C6:G8"), INDEX_RED)

If Not CompleteRows Is Nothing Then
MsgBox CompleteRows.Address
Else
MsgBox "No complete rows coloured"
End If

End Sub

Private Function GetCompleteColouredRows(CheckRange As Range,
ColourIndexToMatch As Long) As Range
Dim i As Long
Dim MatchedRange As Range

With CheckRange
For i = 1 To .Rows.Count
If .Rows(i).Interior.ColorIndex = ColourIndexToMatch Then
If MatchedRange Is Nothing Then
Set MatchedRange = .Cells(i, 1)
Else
Set MatchedRange = Union(MatchedRange, .Cells(i, 1))
End If
End If
Next
End With

Set GetCompleteColouredRows = MatchedRange

End Function

NickHK

"elaine" wrote in message
oups.com...
Hi,

Does anyone know whether there is a way to identify within a range of
F1:CU:5000, which columns is coloured consecutively? (ie. I want to
see which row is coloured in Red from F to CU Throughout.)

Thanks.
Elaine.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Countif non consecutive columns shamor New Users to Excel 8 May 31st 08 09:14 PM
Count non consecutive columns [email protected] Excel Worksheet Functions 7 May 23rd 06 03:24 PM
In Excel, print non-consecutive columns. kwm5321 Excel Discussion (Misc queries) 1 May 3rd 06 06:33 PM
adding three consecutive columns Darin Gibson Excel Worksheet Functions 1 November 22nd 05 08:50 PM
how do i add consecutive columns in excel ? debi Excel Discussion (Misc queries) 1 October 13th 05 06:11 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"