Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Jason Perry   on Dec 21 In MS Office Category.

  
Question Answered By: Rudy Turner   on Dec 21

If I understand, this may help get you started. It will color  all
cells containing "p1" yellow. This could be expanded to different
colors for different text. Brad

Sub ColorMe()
For Each c In ActiveSheet.UsedRange
If Contains("p1", c) Then
With c.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Else
With c.Interior
.ColorIndex = xlNone
.Pattern = xlNone
End With
End If
Next
End Sub

Function Contains(LookFor, LookIn)
On Error GoTo ErrorHandler
temp = Application.WorksheetFunction.Search(LookFor, LookIn)
'if no error
Contains = True
Exit Function
ErrorHandler:
Contains = False
End Function

Share: 

 
 
Didn't find what you were looking for? Find more on Fill color Or get search suggestion and latest updates.


Tagged: