Option
Explicit
Private
Sub
CommandButton1_Click()
Dim
Text1
As
String
Dim
Text2
As
String
Dim
Textfeld1
As
Variant
Dim
Textfeld2
As
Variant
Dim
Variable1
As
Integer
Dim
Variable2
As
Integer
Dim
Variable3
As
Integer
Dim
Variable4
As
Integer
Dim
Variable5
As
Integer
Dim
Variable6
As
Integer
Dim
Variable7
As
Integer
Dim
Variable8
As
Integer
UserForm1.Hide
ThisWorkbook.Worksheets(
"Tabelle1"
).Cells.ClearContents
Text1 = WorksheetFunction.Substitute(UserForm1.TextBox1.Text, vbLf,
""
)
Textfeld1 = Split(Text1, vbCr)
Variable2 = 0
For
Variable1 = 0
To
UBound(Textfeld1)
Variable2 = Variable2 + 1
Text2 = Textfeld1(Variable1)
Textfeld2 = Split(Text2,
" "
)
Variable5 = 0
Variable6 = 0
Variable7 = UBound(Textfeld2)
For
Variable3 = Variable5
To
Variable7
ThisWorkbook.Worksheets(
"Tabelle1"
).Range(
"A"
& Variable2) = ThisWorkbook.Worksheets(
"Tabelle1"
).Range(
"A"
& Variable2) & Textfeld2(Variable3) &
" "
ThisWorkbook.Worksheets(
"Tabelle1"
).Columns(
"A:A"
).EntireColumn.AutoFit
If
ThisWorkbook.Worksheets(
"Tabelle1"
).Columns(
"A:A"
).ColumnWidth > 27.86
Then
Variable8 = Variable3 - 1
ThisWorkbook.Worksheets(
"Tabelle1"
).Range(
"A"
& Variable2) =
""
For
Variable4 = Variable6
To
Variable8
ThisWorkbook.Worksheets(
"Tabelle1"
).Range(
"A"
& Variable2) = ThisWorkbook.Worksheets(
"Tabelle1"
).Range(
"A"
& Variable2) & Textfeld2(Variable4) &
" "
Next
Variable4
Variable6 = Variable8 + 1
Variable3 = Variable3 - 1
Variable2 = Variable2 + 1
End
If
Next
Variable3
Next
Variable1
ThisWorkbook.Worksheets(
"Tabelle1"
).Cells.WrapText =
False
ThisWorkbook.Worksheets(
"Tabelle1"
).Cells.ColumnWidth = 10.71
End
Sub