Bold & increase font size of inStr(...) character's position
Hi Howard,
Am Sat, 8 Aug 2015 23:53:07 -0700 (PDT) schrieb L. Howard:
OneRng values are numbers 1 to 9, such as 123, 124567, 3, 123456789, 456.
If Range("P1") = 3 then I want the 3 in each cell that has a 3, for the 3 to be BOLD and font size to 14.
to format a substring is only possible with TEXT, not with NUMBERS.
If you don't want to calculate with the values you can change it to
text.
Try:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("E2:M10")) Is Nothing _
Or Target.Count 1 Then Exit Sub
Dim pInt As String
Range("E2:M10").NumberFormat = "@"
pInt = Range("P1")
With Target
With .Characters(InStr(.Text, pInt), 1)
.Font.Bold = True
.Font.Size = 14
End With
End With
End Sub
Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
|