HELP!

  • Thread starter Thread starter erikkeith via OfficeKB.com
  • Start date Start date
E

erikkeith via OfficeKB.com

I need to figure out a way to color code a cell off a selection find. Here
is what I currently have:

Range("O1,O12,O34").Select
If Range("AD28").Value = "N" And Application.CountIf(Range("O12:O85"),
"Steve") = 0 Then
On Error Resume Next
Selection.Find(What:="Alternate", LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.Replace What:="Alternate", Replacement:="Steve", LookAt:
=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End If

If the condition is met and the name Steve is input into cell O1, O12 or O34,
I want where ever it is populated to have a specific cell color. How can I
write this into what I have?
 
hi,
add this after the replace...
activecell.interior.colorindex = 5 'blue
to find out all of the color indexes, paste this code in a standard module
in a blank workbook.

Sub macGetColors()
' Macro written 2/10/02 by FSt1

Sheets("Sheet1").Select
Range("B2").Select
Set ci = Range("A1")
ci.Value = 1
Set c = Range("B2")
Do Until ci > 56
Set c2 = c.Offset(1, 0)
Set cnum = c.Offset(0, 1)
c.Interior.ColorIndex = ci.Value
c.Offset(0, 1) = ci.Value
ci.Value = ci.Value + 1
Set c = c2
c.Select
Loop

End Sub

regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top