Option
Explicit
Sub
Beispiel()
Dim
Wert
As
Variant
Dim
Ziel
As
String
Dim
c
As
Range, d
As
Range
Wert = 123456
Ziel =
"B2"
If
Not
Zerlege(Wert, Ziel)
Then
MsgBox
"Fehler in Funktion"
Set
c = Range(
"A1"
)
Set
d = Range(
"B1"
)
If
Not
Zerlege(c, d)
Then
MsgBox
"Fehler in Funktion"
End
Sub
Private
Function
Zerlege(Was, Wohin)
As
Boolean
Dim
Zelle
As
Range
Dim
Bezug
As
String
Dim
Matrix()
As
String
On
Error
GoTo
errorhandler
Bezug = StrConv(Was, vbUnicode)
Matrix = Split(Left(Bezug, Len(Bezug) - 1), vbNullChar)
Select
Case
TypeName(Wohin)
Case
"String"
Set
Zelle = Range(Wohin)
Case
"Range"
Set
Zelle = Range(Wohin.Address)
End
Select
Range(Zelle, Zelle.Offset(0, UBound(Matrix))) = Matrix
Zerlege =
True
Exit
Function
errorhandler:
End
Function