Option Explicit
Sub test()
Dim dic As Object
Dim re As Object
Dim v
Dim i As Long, s As String
Dim k As Long
Dim m
Dim r As String
Set dic = CreateObject("scripting.dictionary")
With Cells(1).CurrentRegion
For i = 1 To .Rows.Count
s = .Cells(i, 2).Value
If Not dic.exists(s) Then Set dic(s) = CreateObject("scripting.dictionary")
dic(s)(.Cells(i, 4).Value) = .Cells(i, 3).Value
Next
Set re = CreateObject("VBScript.RegExp")
re.Pattern = "§(.*?)§"
re.Global = True
For i = 1 To .Rows.Count
s = .Cells(i, 5).Value
If s <> "" Then
r = .Cells(i, 2).Value
For Each m In re.Execute(s)
If dic(r).exists(m.SubMatches(0)) Then
s = Replace(s, m, dic(r)(m.SubMatches(0)))
Else
s = Replace(s, m, "#N/A")
End If
Next
.Cells(i, 5).Value= s
End If
Next
End With
End Sub