Different method
Option Explicit
Sub test()
Dim r As Range, temp, num
Const div As Double = 22.046
With CreateObject("VBScript.RegExp")
For Each r In Range("a1", Range("a" & Rows.Count).End(xlUp))
If r.Value Like "*USD/MT" Then
r.Value = Replace(r.Value, "USD/MT", "USC/LB")
.Pattern = "(\+|\-)(\d+(\.\d+))"
If .test(r.Value) Then
num = Format$(Round(CDbl(.Execute(r.Value)(0).submatches(1)) / div, 2), "#.0000")
r.Value = .Replace(r.Value, .Execute(r.Value)(0).submatches(0) & num)
r.Characters(1, 2).Font.Bold = True
r.Characters(.Execute(r.Value)(0).firstindex + 2, _
.Execute(r.Value)(0).Length - 1).Font.Color = vbRed
End If
.Pattern = "USC/LB"
r.Characters(.Execute(r.Value)(0).firstindex + 1, .Execute(r.Value)(0).Length).Font.Bold = True
End If
Next
End With
End Sub
Bookmarks