Option Explicit
Sub X()
Debug.Print sCarlsbergFunction("123456789A024321")
End Sub
Function sCarlsbergFunction(psInput As String) As String
'123456789A024321 into 1234.56.789.A02.4321.
' constants
Const ksPos = ",4,2,3,3,4"
' declarations
Dim sPos() As String
Dim I As Integer, J As Integer, K As Integer, A As String
' start
sPos() = Split(ksPos, ",")
J = 0
A = ""
' process
For I = 1 To UBound(sPos)
K = CInt(sPos(I))
A = A & Mid(psInput, J + 1, K) & "."
J = J + K
Next I
' end
sCarlsbergFunction = A
End Function