bin neu hier und brauche dringen Hilfe von Euch Profis :)
Ich habe eine Excel Tabelle mit Werten/Texten und dazu eine UserForm1 mit vielen Textfeldern. Die Funktion suchen funktioniert super jedoch möchte ich jetzt die gefundenen Werte in den Textfelder ändern können und per Botton "ändern" sollen sich die Werte/Texte automatisch wieder aktualisieren in der Exceltabelle.
Ich hoffe ich habe es verständlich formuliert und ihr könnt mir somit helfen :)
Hier mein Code:
Private Sub CommandButton6_Click()
Me.PrintForm
End Sub
Private Sub UserForm_Activate()
With ListBox1
.ColumnWidths = "60;90;90;90;0"
.ColumnCount = 5
End With
End Sub
Private Sub ListBox1_Click()
Dim rng As Range
Dim IntC As Integer
Dim lngR As Long
With ListBox1
If .ListCount = 0 Then Exit Sub
If .List(.ListIndex, 0) = "" Then Exit Sub
lngR = CLng(.List(.ListIndex, 4))
Meine_Zeile = Rows(Sheets("bearbeitet").Cells(lngR, 1).Row).Address
For IntC = 1 To 56
Controls("TextBox" & IntC) = Sheets("bearbeitet").Cells(lngR, IntC + 0).Text
Next
End With
TextBox0.SetFocus
End Sub
Private Sub CommandButton1_Click() ' Suchen
Dim rng As Range
Dim strFirst As String
Dim vtmp() As Long
Dim tntC As Integer
If Len(Trim(TextBox0)) = 0 Then Exit Sub
ListBox1.Clear
For IntC = 1 To 56
Controls("TextBox" & IntC) = ""
Next
ReDim vtmp(0)
With Sheets("bearbeitet")
Set rng = .Range("B:F").Find(What:=TextBox0, Lookat:=xlPart)
If Not rng Is Nothing Then
strFirst = rng.Address
Do
If Not (IsNumeric(Application.Match(rng.Row, vtmp, 0))) Then
ReDim Preserve vtmp(UBound(vtmp) + 0)
vtmp(UBound(vtmp)) = rng.Row
ListBox1.AddItem .Cells(rng.Row, 5)
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(rng.Row, 3)
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(rng.Row, 2)
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(rng.Row, 9)
ListBox1.List(ListBox1.ListCount - 1, 4) = rng.Row
End If
Set rng = .Range("B:F").FindNext(rng)
Loop While Not rng Is Nothing And rng.Address strFirst
End If
End With
If ListBox1.ListCount > 0 Then
ListBox1.ListIndex = 0
Else
ListBox1.AddItem "Kein Eintrag!"
End If
Set rng = Nothing
End Sub
Private Sub CommandButton5_Click() ' Beenden
Unload Me
End Sub