clarksonneo
07-29-2011, 05:42 AM
Hi,
I have written a macro but it doesn’t work.
Could you please correct the macro?
The macro can perform this task:
I will select some cells in column A.
The macro will find the text in the cell in column A within the text in column B in the same row.
For example, if cell A1’s value is John, then the word – John in cell B1 will be bold.
For example, if cell A2’s value is May, then the word – May in cell B2 will be bold.
Please see the picture and code below.
Thanks
Sub bold()
For Each x In Selection
Set i = Application.WorksheetFunction.Find(x.Value, x.Offset(0, 1).Value)
j = Len(x.Value)
With x.Offset(0, 1).Characters(Start:=i, Length:=j).Font
.FontStyle = "bold"
End With
Next
End Sub
I have written a macro but it doesn’t work.
Could you please correct the macro?
The macro can perform this task:
I will select some cells in column A.
The macro will find the text in the cell in column A within the text in column B in the same row.
For example, if cell A1’s value is John, then the word – John in cell B1 will be bold.
For example, if cell A2’s value is May, then the word – May in cell B2 will be bold.
Please see the picture and code below.
Thanks
Sub bold()
For Each x In Selection
Set i = Application.WorksheetFunction.Find(x.Value, x.Offset(0, 1).Value)
j = Len(x.Value)
With x.Offset(0, 1).Characters(Start:=i, Length:=j).Font
.FontStyle = "bold"
End With
Next
End Sub