View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bettergains Bettergains is offline
external usenet poster
 
Posts: 33
Default Fix Code: Select Case and "Contains" selection

Thanks, Bob. that is the syntax I was looking for.

Also, can 3 options be used with Case Selects? I've edited the code below to
show what I am referring to. Obviously, the edited syntax does NOT work.

"Bob Phillips" wrote:

Dim Mark As Range

For Each Mark In Union([D6:F1200], [AF6:AF1200]).Cells

With Mark
.Font.Color = vbBlack
.Font.Bold = False
Select Case True
Case .Value Like "*Option1*" Or _
.Value Like "*Option2*" or _

.value like "*Option3*"
.Font.ColorIndex = 55
.Font.Bold = True
Case Else
End Select
End With
Next Mark

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bettergains" wrote in message
...
Hello: Here's my code. I want to look for anything that contains the
following values: "Option1" and "Option2". Sometimes it will be the

single
value in the cell, somtimes it will be part of a string. I have tried
numerous syntaxes, but am coming up empty. HELP~

Dim Mark As Range

For Each Mark In Union([D6:F1200], [AF6:AF1200]).Cells

Select Case Mark.Value
Case "Option1"
Mark.Font.ColorIndex = 55
Mark.Font.Bold = True
Case "Option2"
Mark.Font.ColorIndex = 55
Mark.Font.Bold = True
Case Else
Mark.Font.Color = vbBlack
Mark.Font.Bold = False
End Select
Next