Thread
:
Macro Error Help
View Single Post
#
6
Posted to microsoft.public.excel.misc
Don Guillett
external usenet poster
Posts: 10,124
Macro Error Help
Glad to help
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"C. Hernandez" wrote in message
...
Thank you so much! That worked like a charm.
--
~ Chris
"Don Guillett" wrote:
Just change a,b,c,d to your text. Since you are looking for PART, could
even
be "comp","adv", UNLESS they are part of any possible word. So, better to
use the whole text.
Sub Findemall()
On Error Resume Next
For Each mStr In Array("a", "b", "c", "d")
Cells.Find(What:=mStr, After:=ActiveCell, _
LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False).entirerow.Interior.ColorIndex = 36
Next mStr
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"C. Hernandez" wrote in message
...
Hello, I am fairly new at VBA and created a macro to search for
particular
text and then highlight the entire row when the text is found, but if
one
of
the text values is missing, the macro errors. I believe the Dim V is
the
way
to go, but I've it written wrong. Please help.
This is my formatting code that if all the values are found it works
fine.
Cells.Find(What:="COMPENSATION & FRINGE", After:=ActiveCell,
LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
With Selection.EntireRow.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
Cells.Find(What:="ADVERTISING,DIRECT MAIL,COLL2", After:=ActiveCell,
LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
With Selection.EntireRow.Interior
.ColorIndex = 36
.Pattern = xlSolid
End With
--
~ Chris
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett