AW: Userform
21.06.2017 14:22:40
Nepumuk
Hallo MG,
ich hab das mal in das Click-Event eines CommandButtons gelegt:
Private Sub CommandButton1_Click()
Dim objCell As Range
With TextBox1
.Text = Trim$(.Text)
If .TextLength > 0 Then
Set objCell = ActiveSheet.Columns(1).Find(What:=.Text, LookIn:=xlValues, LookAt:=xlWhole)
If Not objCell Is Nothing Then
Call objCell.Offset(0, 1).Resize(1, 31).Copy( _
Destination:=Cells(Rows.Count, 1).End(xlUp).Offset(1, 1))
.Text = vbNullString
Set objCell = Nothing
Else
Call MsgBox("Die angegebene Nummer wurde nicht gefunden.", vbExclamation, "Hinweis")
.SelStart = 0
.SelLength = .TextLength
Call .SetFocus
End If
Else
Call MsgBox("Bitte eine Laufnummer eingeben.", vbExclamation, "Hinweis")
Call .SetFocus
End If
End With
End Sub
Gruß
Nepumuk