Hi!
I am trying to make an advanced bold making macro, but something is wrong.
What I want:
Column A:
apple
by the way
meet me
Column B:
I eat an apple.
By the way, you are pretty.
Meet me halfway.
Output (column B, just making bold some words):
I eat an apple.
By the way, you are pretty.
Meet me halfway.
I inserted my code. Could you help me out? Thank you very much!
I am trying to make an advanced bold making macro, but something is wrong.
What I want:
Column A:
apple
by the way
meet me
Column B:
I eat an apple.
By the way, you are pretty.
Meet me halfway.
Output (column B, just making bold some words):
I eat an apple.
By the way, you are pretty.
Meet me halfway.
I inserted my code. Could you help me out? Thank you very much!
Code:
Sub test()
Dim Wrd As Variant
Dim Wrd2 As Variant
Dim Cl As Range
Dim D1 As Range
Set D1 = Range("B" & Rows.Count).End(xlUp)
For Each Cl In Range("A1", Range("A" & Rows.Count).End(xlUp))
For Each Wrd In Split(Cl, " ")
For Each Wrd2 In Split(D1, " ")
If Left(Wrd, 2) = Left(Wrd2, 2) Then 'wrd: apple--> ap = wrd2: apples--> ap
Wrd2.Font.Bold = True
End If
Next Wrd2
Next Wrd
Next C1
End Sub
Last edited: