ich habe folgenden code in einer userform. nun möchte ich diese um ein feld erweitern in diesem fall '"tbDrum_Number". diesen nachstehenden code habe ich eingegeben, aber leider wird mir nicht in meiner userform die nummer der Trommel angezeigt. vielleicht kann mich ja jemand von euch mit der nase darauf stossen damit diese teil wieder funktioniert.
auf jeden fall ein danke an euch alle.
gruß
hartmut
Private Sub tbCable_Number_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim rngLast As Range, lngZ As Long, vTst
Dim lboFehler As Boolean
If tbCable_number.Text = "" Then lboFehler = True
If lboFehler = True Then
MsgBox "Es ist kein Eintrag vorhanden!!!"
Exit Sub
End If
With Sheets("Cable List")
Set rngLast = .Cells(.Rows.Count, 16).End(xlUp) ' letzter Eintrag Sp. 15
' Suche mit Match = VERGLEICH
vTst = 5 + Application.Match(tbCable_number, _
.Range(.Cells(6, 16), rngLast), 0)
If IsNumeric(vTst) Then ' wenn gefunden, ...
lngZ = vTst
tbCable_number = .Cells(lngZ, 16) ' war schon gleich
tbCable_Type = .Cells(lngZ, 17)
tbEndjunction_from = .Cells(lngZ, 18)
tbLocation_from = .Cells(lngZ, 19)
tbEndjunction_to = .Cells(lngZ, 20)
tbLocation_to = .Cells(lngZ, 21)
'tbDrum_Number = .Cells(lngZ, 15)
End If
End With
End Sub
Private Sub CommandButton1_Click()
With Sheets("Cable List")
With .Cells(.Rows.Count, 15).End(xlUp).Offset(1)
.Offset(, 0).Value = tbDrum_Number
.Offset(, 1).Value = tbCable_number
.Offset(, 2).Value = tbCable_Type
.Offset(, 3).Value = tbEndjunction_from
.Offset(, 4).Value = tbLocation_from
.Offset(, 5).Value = tbEndjunction_to
.Offset(, 6).Value = tbLocation_to
End With
End With
tbDrum_Number = ""
tbCable_number = ""
tbCable_Type = ""
tbEndjunction_from = ""
tbLocation_from = ""
tbEndjunction_to = ""
tbLocation_to = ""
End Sub