Function AFormat(ByVal sStr As String, ByVal sFormat As String) As String Dim sF() As String Dim sS() As String Dim i As Integer, j As Integer, k As Integer sF = Split(sFormat, "-") i = UBound(sF) sS = Split(sStr, "-") j = UBound(sS) ReDim Preserve sS(i + 1) For k = j + 1 To i sS(k) = sF(k) Next For k = 0 To i sS(k) = Format(sS(k), sF(k)) Next AFormat = Join(sS, "-") AFormat = Left(AFormat, Len(AFormat) - 1) End Function