Gruppe
Dialog
Problem
Wie kann ich Adressdaten in einen Dialog eingeben und diese dann in eine Adressdatei eintragen lassen?
ClassModule: Tabelle2
Private Sub Worksheet_BeforeDoubleClick( _
ByVal Target As Range, Cancel As Boolean)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect( _
Target, Range("A1").CurrentRegion _
) Is Nothing Then Exit Sub
Cancel = True
frmAddress.Show
End Sub
ClassModule: frmAddress
Private Sub cboName_Change()
Dim iCol As Integer
For iCol = 1 To 7
Controls("TextBox" & iCol).Text = _
Cells(ActiveCell.Row, iCol + 1).Value
Next iCol
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim iRow As Integer, iCol As Integer
If cboName.ListIndex = -1 Then
iRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Else
iRow = ActiveCell.Row
End If
Cells(iRow, 1).Value = cboName.Value
For iCol = 1 To 7
Cells(iRow, iCol + 1).Value = _
Controls("TextBox" & iCol).Text
Next iCol
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize()
Dim iRow As Integer
iRow = 2
With cboName
Do Until IsEmpty(Cells(iRow, 1))
.AddItem Cells(iRow, 1).Value
iRow = iRow + 1
Loop
.ListIndex = ActiveCell.Row - 2
End With
End Sub