Gruppe
Dialog
Problem
Im Texfeld einer UserForm-ComboBox soll immer der Wert aus Spalte 1 zusammen mit dem Wert aus Spalte 2 angezeigt werden, ohne dass das Auslesen der Auswahl beeinträchtigt wird.
ClassModule: frmTowColumns
Private Sub cboTwoColumns_Change()
Dim iCounter As Integer, iRow As Integer
Dim sSelect As String
With cboTwoColumns
If .ListIndex >= 0 Then
sSelect = .List(.ListIndex, 0) & " - " & .List(.ListIndex, 1)
iRow = .ListIndex
cboTwoColumns.Text = sSelect
End If
For iCounter = 1 To 3
Controls("TextBox" & iCounter).Text = .List(iRow, iCounter - 1)
Next iCounter
End With
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
cboTwoColumns.List = Range("A1").CurrentRegion.Value
End Sub
StandardModule: Modul1
Sub DialogAufruf()
frmTowColumns.Show
End Sub