Ich habe im Forum nachfolgenden Code gefunden und für meine Bedürfnisse nur leicht verändert.
Ich bekomme es aber nicht hin, das ich die Daten über Userform von Tabelle "Berechnung " aufrufen und aktualisieren
kann. Die Userform möchte ich aus Tabelle "Menue" aufrufen.
Im gleichen Tabellenblatt funktioniert es.
Meine Bitte: Wer kann mir den Code so umschreiben das es funktioniert.
Die Beispieldatei habe ich beigefügt.
https://www.herber.de/bbs/user/33274.xls
Besten Dank im Vorraus.
Frank
Option Explicit
Private Sub CommandButton1_Click()
Dim intCounter As Integer
For intCounter = 4 To 15
Cells(intCounter, 1) = ListBox1.List(intCounter - 4, 0)
Cells(intCounter, 2) = ListBox1.List(intCounter - 4, 1)
Cells(intCounter, 3) = ListBox1.List(intCounter - 4, 2)
Cells(intCounter, 4) = ListBox1.List(intCounter - 4, 3)
Next intCounter
Unload Me
End Sub
Private Sub CommandButton2_Click()
Unload Me
End Sub
Private Sub ListBox1_Click()
TextBox1 = ListBox1.List(ListBox1.ListIndex, 1)
TextBox2 = ListBox1.List(ListBox1.ListIndex, 2)
TextBox3 = ListBox1.List(ListBox1.ListIndex, 3)
TextBox1.SetFocus
End Sub
Private Sub TextBox1_Change()
ListBox1.List(ListBox1.ListIndex, 1) = TextBox1
End Sub
Private Sub TextBox2_Change()
ListBox1.List(ListBox1.ListIndex, 2) = TextBox2
End Sub
Private Sub TextBox3_Change()
ListBox1.List(ListBox1.ListIndex, 3) = TextBox3
End Sub
Private Sub UserForm_Initialize()
Dim intCounter As Integer
For intCounter = 4 To 15
ListBox1.AddItem Cells(intCounter, 1)
ListBox1.List(intCounter - 4, 1) = Cells(intCounter, 2)
ListBox1.List(intCounter - 4, 2) = Cells(intCounter, 3)
ListBox1.List(intCounter - 4, 3) = Cells(intCounter, 4)
Next intCounter
ListBox1.ListIndex = 0
End Sub