Option
Explicit
Sub
TestIt()
tFormat 1, 2,
"-"
End
Sub
Private
Sub
tFormat(Spalte
As
Variant
, Schritt
As
Long
, Teiler
As
String
)
Dim
ary()
As
Variant
, x
As
Long
With
Columns(Spalte)
ary = .Range(.Cells(1), .Cells(.Cells.Count).
End
(xlUp)).Value
For
x = LBound(ary, 1)
To
UBound(ary, 1)
If
VarType(ary(x, 1)) = 8
Then
ary(x, 1) = SplIt(ary(x, 1), Schritt, Teiler)
End
If
Next
x
.Cells(1).Resize(UBound(ary, 1), UBound(ary, 2)).Value = ary
End
With
End
Sub
Private
Function
SplIt(Text, Abst, Mit)
As
String
Dim
z
As
Long
, Tx
As
String
For
z = 1
To
Len(Text)
Step
Abst
Tx = Tx & Mit & Mid(Text, z, Abst)
Next
z
Tx = Mid(Tx, 1 + Len(Mit))
SplIt = Tx
End
Function