Adapting some code

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




Hi all,

Some of you were kind enough to help me with this bit of code a little
while ago, I now need to adapt it however. I need to add a 3rd range
ie (o2:o20) and alter anything in that range to say, grey text


Sub Find_Exceptions()

Dim entry As Range, foundentry As Range, firstaddress As String
Dim rng1 As Range, Rng2 As Range

Set rng1 = Range("b4:h76")
Set Rng2 = Range("M2:M20")

For Each entry In rng1
If Not IsError(Application.Match _
(entry.Value, Rng2, 0)) Then
Set foundentry = rng1.Find(After:=rng1(1), _
What:=entry.Value, _
SearchOrder:=xlByColumns, _
SearchDirection:=xlNext, _
LookIn:=xlValues, LookAt:=xlWhole)
If Not foundentry Is Nothing Then
firstaddress = foundentry.Address
Do
With foundentry.Font
ColorIndex = 5
Bold = True
Italic = True
End With
Set foundentry = rng1.FindNext(After:=foundentry)
Loop While Not foundentry Is Nothing _
And foundentry.Address <> firstaddress
End If
End If
Next entry

is this possible?
End Sub


--
chrisrowe_cr
------------------------------------------------------------------------
chrisrowe_cr's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=25220
View this thread: http://www.excelforum.com/showthread.php?threadid=396048

.



Relevant Pages

  • Re: Adapting some code
    ... > Sub Find_Exceptions ... > Dim entry As Range, foundentry As Range, firstaddress As String ...
    (microsoft.public.excel.programming)
  • Re: adapting the findnext function
    ... Dim entry As Range, foundentry As Range, firstaddress As String ... > Sub FormatFoundValues() ... > Dim entry As Range, foundentry As Range, firstaddress As String ...
    (microsoft.public.excel.programming)
  • Re: adapting the findnext function
    ... Dim entry As Range, foundentry As Range, firstaddress As String ... > Sub FormatFoundValues() ... > Dim entry As Range, foundentry As Range, firstaddress As String ...
    (microsoft.public.excel.programming)
  • Re: Adapting some code
    ... Sub Find_Exceptions ... Dim entry As Range, foundentry As Range, firstaddress As String ... > Dim entry As Range, foundentry As Range, firstaddress As String ...
    (microsoft.public.excel.programming)
  • Re: Adapting some code
    ... > Bob Phillips Wrote: ... >> Dim entry As Range, foundentry As Range, firstaddress As String ... >> HTH ...
    (microsoft.public.excel.programming)