Private
Sub
cmd_VSave_Click()
Dim
iRow
As
Long
If
Lst_Vrmtr.ListIndex = -1
Then
Exit
Sub
If
Trim(
CStr
(txt_VName.Text)) =
""
Then
MsgBox
"Bitte trage einen Namen ein!"
, vbCritical + vbOKOnly,
"Fehler!"
Exit
Sub
End
If
iRow = 2
Do
While
Trim(
CStr
(WksVrmtr.Cells(iRow, 1).Value)) <>
""
If
Lst_Vrmtr.List(Lst_Vrmtr.ListIndex, 0) = Trim(
CStr
(WksVrmtr.Cells(iRow, 1).Value))
Then
With
WksVrmtr
.Cells(iRow, 1).Value = Trim(
CStr
(txt_VID.Text))
.Cells(iRow, 2).Value = txt_VName.Text
.Cells(iRow, 3).Value = cmb_VAnrede.Text
.Cells(iRow, 4).Value = txt_VHandyA.Text
.Cells(iRow, 5).Value = txt_VHandyB.Text
.Cells(iRow, 6).Value = txt_VFestnetz.Text
.Cells(iRow, 7).Value = txt_VFax.Text
.Cells(iRow, 8).Value = txt_VMail.Text
.Cells(iRow, 9).Value = txt_VHomepage.Text
.Cells(iRow, 10).Value = txt_VAnmerkung.Text
End
With
If
Lst_Vrmtr.List(Lst_Vrmtr.ListIndex, 1) <> Trim(
CStr
(txt_VName.Text))
Then
Call
UserForm_Initialize
If
Lst_Vrmtr.ListCount > 0
Then
ListBox1.ListIndex = 0
Exit
Do
End
If
iRow = iRow + 1
Loop
End
Sub