Gruppe
Dialog
Problem
Wie kann ich bedingt durch die Auswahl in einer Mehrspalten-ListBox eine zweite UserForm aufrufen?
ClassModule: frmListe
Private Sub cmdContinue_Click()
Unload Me
End Sub
Private Sub lstPersonal_Click()
Dim iCounter As Integer
For iCounter = 1 To 7
frmPersonal.Controls("TextBox" & iCounter).Text = _
lstpersonal.List(lstpersonal.ListIndex, iCounter - 1)
Next iCounter
End Sub
Private Sub UserForm_Initialize()
Dim rng As Range
Set rng = Range("A1").CurrentRegion
lstpersonal.List = rng.Rows(2, rng.Rows.Count).Value
End With
End Sub
ClassModule: frmPersonal
Private Sub cmdContinue_Click()
Unload Me
End Sub
Private Sub cmdInsert_Click()
Dim iCounter As Integer
gbln = True
For iCounter = 1 To 7
With frmListe.lstPersonal
Worksheets("Dummy").Cells(1, iCounter).Value = _
.List(.ListIndex, iCounter - 1)
.List(.ListIndex, iCounter - 1) = _
Controls("TextBox" & iCounter).Text
Cells(.ListIndex + 2, iCounter).Value = _
.List(.ListIndex, iCounter - 1)
End With
Next iCounter
cmdReset.Enabled = True
End Sub
Private Sub cmdReset_Click()
Dim iCounter As Integer
For iCounter = 1 To 7
With frmListe.lstPersonal
.List(.ListIndex, iCounter - 1) = _
Worksheets("Dummy").Cells(1, iCounter).Value
Cells(.ListIndex + 2, iCounter).Value = _
Worksheets("Dummy").Cells(1, iCounter).Value
End With
Next iCounter
cmdReset.Enabled = False
gbln = False
End Sub
StandardModule: basMain
Sub CallForm()
frmListe.Show
End Sub