Does anybody know how to conditionally format a cell based on a text string?
For Example: I would like the background of the cell to be blue and the font white if the text starts with I or V or X (Roman Numeral).
Thanks!
Does anybody know how to conditionally format a cell based on a text string?
For Example: I would like the background of the cell to be blue and the font white if the text starts with I or V or X (Roman Numeral).
Thanks!
I don't think it is possible to solve without using macro
Try this macro
Sub macro()
Dim ini As Variant
Dim k, k1 As Variant
k = 1
Cells.Select
While ActiveCell.Address <> ini Or k = 2
On Error Resume Next
Cells.Find(What:="I*", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True) _
.Activate
If ini <> ActiveCell.Address Then
End If
If k = 1 Then
ini = ActiveCell.Address
End If
If Err.Description <> "" Then
GoTo a3:
Else
With ActiveCell.Interior
.ColorIndex = 33
.Pattern = xlSolid
End With
ActiveCell.Font.Bold = True
ActiveCell.Font.ColorIndex = 2
End If
k = k + 1
Wend
a3:
Err.Clear
k = 1
Cells.Select
Err.Clear
ini = ""
While ActiveCell.Address <> ini Or k = 2
On Error Resume Next
Cells.Find(What:="X*", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True) _
.Activate
If ini <> ActiveCell.Address Then
End If
If k = 1 Then
ini = ActiveCell.Address
End If
If Err.Description <> "" Then
GoTo a1:
Else
With ActiveCell.Interior
.ColorIndex = 33
.Pattern = xlSolid
End With
ActiveCell.Font.Bold = True
ActiveCell.Font.ColorIndex = 2
End If
k = k + 1
Wend
a1:
Err.Clear
k = 1
ini = ""
Cells.Select
While ActiveCell.Address <> ini Or k = 2
On Error Resume Next
Cells.Find(What:="V*", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True) _
.Activate
If ini <> ActiveCell.Address Then
End If
If k = 1 Then
ini = ActiveCell.Address
End If
If Err.Description <> "" Then
GoTo a2:
Else
With ActiveCell.Interior
.ColorIndex = 33
.Pattern = xlSolid
End With
ActiveCell.Font.Bold = True
ActiveCell.Font.ColorIndex = 2
End If
k = k + 1
Wend
a2:
End Sub
WOW...I figured it would be a simple conditional fomrat. I will give your macro a shot and see if that will work.
Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks