When I try strings like this:
1 My Dog's Name Is Fido
2 Fido Is What I Call My Dog
3 Name the Dog Fido
The string Name in Rows 1 and 3 will be bolded, but so will Fido in Row 2.
This is because InStr(.Value, “Name”) returns 0 if Name isn't found and the first 4 characters will be bolded.
I don't know if that's a problem for you, but that's what I found to be happening with my data.
Of course, this doesn't address your question, but I thought I'd mention it anyway.
I believe that this code will get you what you want. It's an adaptation of the code found at this site, which counts the occurrences of a pattern of characters in a cell.
By looping through the cell, character by character, looking for 4 character strings that match "Name", it will bold all occurrences.
Just to be efficient, it will skip any cell that doesn't contain the string Name.
With Worksheets("Label Print").Cells(i, J)
If .Value Like "*Name*" Then
For c = 1 To Len(.Value)
If Mid(.Value, c, Len("Name")) = "Name" Then
.Characters(Start:=c, Length:=Len("Name")).Font.Bold = True
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.