jolivanes
Well-known Member
- Joined
- Sep 5, 2004
- Messages
- 3,186
- Office Version
- 2013
- 2007
- Platform
- Windows
I want to change the font color for certain found names in a range.
I hoped that the above code would do it but it colors about 70 percent of the entries in the column. At the moment there are +/- 200 names so obviously the code does not work.
It seems that it does not like the "DR & i" in the "Find(What:=DR & i," part.
Could someone set me straight on this please.
Thank you very much in advance
John
Code:
Sub ColorThePeople()
DR1 = "Person One"
DR2 = "Person Two"
DR3 = "Person Three"
DR4 = "Person Four"
DR5 = "Person Five"
DR6 = "Person Six"
DR7 = "Person Seven"
DR8 = "Person Eight"
DR9 = "Person Nine"
DR10 = "Person Ten"
DR11 = "Person Eleven"
DR12 = "Person Twelve"
i = 1
For Each c In Range("G4", Range("G" & Rows.Count).End(xlUp))
With ActiveSheet
Set rFound = .Columns(7).Find(What:=DR & i, After:=.Cells(4, 7), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
End With
rFound.Font.ColorIndex = 45
i = i + 1
Next
End Sub
I hoped that the above code would do it but it colors about 70 percent of the entries in the column. At the moment there are +/- 200 names so obviously the code does not work.
It seems that it does not like the "DR & i" in the "Find(What:=DR & i," part.
Could someone set me straight on this please.
Thank you very much in advance
John