Gruppe
Dialog
Problem
Der Inhalt aus Spalte A soll in einer UserFormListBox in jeweils zwei Zeilen aufgeteilt werden.
StandardModule: Modul1
Sub CallForm()
frmSplit.Show
End Sub
ClassModule: frmSplit
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim iRow As Integer
Dim sTxt As String
iRow = 1
Do Until IsEmpty(Cells(iRow, 1))
sTxt = Cells(iRow, 1).Value
If InStr(sTxt, vbLf) Then
With lstValues
.AddItem Left(sTxt, InStr(sTxt, vbLf) - 1)
.AddItem Right(sTxt, Len(sTxt) - InStr(sTxt, vbLf))
End With
End If
iRow = iRow + 1
Loop
End Sub