For Each c In Range("B1:C4")
Perhaps you you start your own thread rather than hijack this current one. You can put a link to this thread in your new one if you want.@Peter_SSs
may you mod this line
I would to be dynamic . is there any way if the range increases without I have to change the range when increase data every time?VBA Code:For Each c In Range("B1:C4")
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("O:O")) Is Nothing Then
Dim RX As Object, M As Object
Dim a As Variant
Dim i As Long
Target.Font.Bold = False
Set RX = CreateObject("VBScript.RegExp")
RX.Global = True
RX.IgnoreCase = True
RX.MultiLine = True
a = Keywords.Range("A1", Keywords.Range("A" & Rows.Count).End(xlUp)).Value
For Each c In Target
With c
For i = 1 To UBound(a)
RX.Pattern = a(i, 1)
For Each M In RX.Execute(.Value)
.Characters(M.FirstIndex + 1, Len(M)).Font.Bold = True
Next M
Next i
End With
Next c
End If
End Sub
Welcome to the MrExcel board!I would appreciate any help I can get on this.
Partial bold.xlsm | ||||||
---|---|---|---|---|---|---|
A | B | C | D | |||
1 | Info | Keyword | ||||
2 | Gain 1 Mana Crystals this turn only. | Battlecry | ||||
3 | Deal 1 damage. | Charge | ||||
4 | Battlecry: Spend all your Mana. Gain +1/+1 for each mana spent. | Choose One | ||||
5 | Choose One - Summon a Jade Golem; or Shuffle 3 copies of this card into your deck. | Deathrattle | ||||
6 | Quest: Summon 5 minions with 5 or more Attack. Reward: Barnabus | Discover | ||||
7 | Choose One - Deal 2 damage; or Summon two 1/1 Saplings. | Jade Golem | ||||
8 | Choose One - Discover a minion; or Discover a spell. | Nature Spell Damage +3 | ||||
9 | Deal damage equal to your hero's Attack to a minion. | Spell Damage | ||||
10 | Taunt. Choose One - +1 Attack; or +1 Health. | Spell Damage +2 | ||||
11 | Battlecry: Gain an empty Mana Crystal. Deathrattle: Lose a Mana Crystal. | Spell Damage +3 | ||||
12 | Battlecry: Destroy all damaged minions. | |||||
13 | Battlecry: Draw 3 cards. Put any minions you drew directly into the battlefield. | |||||
14 | Nature Spell Damage +3 | |||||
15 | Spell Damage +1 | |||||
16 | ||||||
Cardlist |
Private Sub Worksheet_Change(ByVal Target As Range)
Dim RX As Object, M As Object
Dim a As Variant
Dim i As Long
Dim Changed As Range, c As Range
Set Changed = Intersect(Target, Range("Table1[Info]"))
If Not Changed Is Nothing Then
Set RX = CreateObject("VBScript.RegExp")
RX.Global = True
RX.IgnoreCase = True
RX.MultiLine = True
Changed.Font.Bold = False
a = Sheets("Keywords").Range("Table2[Keyword]").Value
For Each c In Changed
With c
For i = 1 To UBound(a)
RX.Pattern = Replace(a(i, 1), "+", "\+")
For Each M In RX.Execute(.Value)
.Characters(M.FirstIndex + 1, Len(M)).Font.Bold = True
Next M
Next i
End With
Next c
End If
End Sub