Here's another...
Private Sub CommandButton1_Click()
Dim n, i As Long, ii As Long, x, y
With CreateObject("vbscript.regexp")
.MultiLine = True
.Global = True
.IgnoreCase = False
.Pattern = "(\s\d+;)"
x = Range("B2:E" & Range("B" & Rows.Count).End(xlUp).Row).Value
ReDim y(2 To UBound(x), 1 To 4)
For i = 2 To UBound(x)
For ii = 2 To 4
Set myMatches = .Execute(x(i, ii))
For Each n In myMatches
y(i, ii) = Val(y(i, ii)) + Val(Trim(Split(n, ";")(0)))
Next n
Next ii
Next i
End With
Range("H3").Resize(UBound(y, 1) - 1, UBound(y, 2)).Value = y
Range("H2").Resize(1, 4).Value = Application.Index(x, 1, 0)
Range("H2").Resize(UBound(x)).Value = Application.Index(x, 0, 1)
End Sub
Bookmarks