I'm kind of confused, but maybe this will help:
Option Explicit
Sub testme()
Dim myBaseCell As Range
Dim myCell As Range
Dim myRng As Range
Dim myColorIndex As Long
Set myBaseCell = Nothing
On Error Resume Next
Set myBaseCell = Application.InputBox(Prompt:="select your cell", _
Type:=8).Cells(1)
On Error GoTo 0
If myBaseCell Is Nothing Then
Exit Sub 'user hit cancel
End If
myColorIndex = myBaseCell.Interior.ColorIndex
For Each myCell In Worksheets("sheet1").UsedRange
If myCell.Interior.ColorIndex = myColorIndex Then
If myRng Is Nothing Then
Set myRng = myCell
Else
Set myRng = Union(myCell, myRng)
End If
End If
Next myCell
If myRng Is Nothing Then
MsgBox "No cells found"
Else
MsgBox "Found here: " & myRng.Address(0, 0)
End If
End Sub
> Dave
>
[quoted text clipped - 4 lines]
>
> Jim.

Signature
Dave Peterson
Jim Mills - 24 Mar 2005 17:17 GMT
Dave
Perfect, very many thanks.
Jim
> I'm kind of confused, but maybe this will help:
>
[quoted text clipped - 47 lines]
>
> Dave Peterson