Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Daten aus Tabelle auslesen, verändern + abspeicher

Forumthread: Daten aus Tabelle auslesen, verändern + abspeicher

Daten aus Tabelle auslesen, verändern + abspeicher
10.03.2004 11:25:44
Stefane
Hallo Leute,
ich habe folgendes Problem: Ich habe ein Userform, mit dem ich Daten aus ner Tabelle auslese und auswählen, anklicken kann. Der ausgewählte Datensatz steht dann in den Textboxes. Die Auswahl erfolgt über eine Listbox. Wie kann ich die Daten verändert über den alten Datensatz speichern, wenn ich die Daten in den Textboxes manuell ändere ?
MfG
Stefan
Achja, hier die Formel:

Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
On Error GoTo 1
ListBox1.SetFocus
'tpk = 1
ListBox1.BoundColumn = 1
txtlaufendeNummer.Value = ListBox1.Value
ListBox1.BoundColumn = 2
txtAnlagennummer.Value = ListBox1.Value
ListBox1.BoundColumn = 5
txtStandort.Value = ListBox1.Value
ListBox1.BoundColumn = 3
txtBeschreibung1.Value = ListBox1.Value
ListBox1.BoundColumn = 4
txtBeschreibung2.Value = ListBox1.Value
ListBox1.BoundColumn = 6
txtAnlagenklasse.Value = ListBox1.Value
ListBox1.BoundColumn = 7
txtAnlagensachgruppe.Value = ListBox1.Value
ListBox1.BoundColumn = 9
txtKostenstelle.Value = ListBox1.Value
ListBox1.BoundColumn = 10
txtProdukt.Value = ListBox1.Value
ListBox1.BoundColumn = 13
txtSeriennummer.Value = ListBox1.Value
ListBox1.BoundColumn = 12
txtLieferantennummer.Value = ListBox1.Value
ListBox1.BoundColumn = 19
txtAnschaffungsjahr.Value = ListBox1.Value
txtAnschaffungsjahr2.Value = ListBox1.Value
ListBox1.BoundColumn = 8
txtAnlagenbuchungsgruppe.Value = ListBox1.Value
ListBox1.BoundColumn = 24
txtAnschaffungskosten.Value = ListBox1.Value
txtAnschaffungskosten2.Value = ListBox1.Value
ListBox1.BoundColumn = 16
txtStartdatumAfa.Value = ListBox1.Value
ListBox1.BoundColumn = 15
txtAfaMethode.Value = ListBox1.Value
ListBox1.BoundColumn = 17
txtAbschreibung.Value = ListBox1.Value
ListBox1.BoundColumn = 14
txtGesperrt.Value = ListBox1.Value
ListBox1.BoundColumn = 20
txtBelegdatum.Value = ListBox1.Value
ListBox1.BoundColumn = 21
txtBelegnummer.Value = ListBox1.Value
ListBox1.BoundColumn = 22
txtexterneBelegnummer.Value = ListBox1.Value
ListBox1.BoundColumn = 23
txtBeschreibung3.Value = ListBox1.Value
ListBox1.BoundColumn = 26
txtAnlagedatum.Value = ListBox1.Value
ListBox1.BoundColumn = 27
txtBelegdatum2.Value = ListBox1.Value
ListBox1.BoundColumn = 28
txtBelegnummer2.Value = ListBox1.Value
ListBox1.BoundColumn = 29
txtexterneBelegnummer2.Value = ListBox1.Value
ListBox1.BoundColumn = 30
txtBeschreibung4.Value = ListBox1.Value
ListBox1.BoundColumn = 31
txtjährlicherAbschreibungsbetrag.Value = ListBox1.Value
1:
End Sub


Private Sub UserForm_Initialize()
Dim r As Variant
ListBox1.ColumnCount = 31
r = Cells(65536, 2).End(xlUp).Row
ListBox1.RowSource = "A2:AE" & r
End Sub

Anzeige

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Daten aus Tabelle auslesen, verändern + abspeicher
10.03.2004 15:13:08
Stefane
Hallo Beni,
danke erstmal für Deine Beispiel-Datei. Dort funktioniert das auch! Leider nur in meiner Datei nicht. Es gibt ne Fehlermeldung: FEHLER BEIM KOMPILIEREN: Variable nicht definiert:
Gemeint ist damit die Zeile (If Zeile = "" Then Exit Sub). Hier, so sieht mein Code aus!
Gruß Stefan

Option Explicit

Private Sub cmdZurück_Click()
Unload Me
usreingabefeld.Show
End Sub


Private Sub UserForm_Initialize()
Worksheets("Anlagenklassen").Activate
Me.cboAnlagenklasse.RowSource = ("A2:B79")
Me.cboAnlagenklasse.ListIndex = "0"
Me.cboAnlagensachgruppe.RowSource = ("I2:J35")
Me.cboAnlagensachgruppe.ListIndex = "0"
Worksheets("Produkte").Activate
Me.cboProdukt.RowSource = ("A2:B31")
Me.cboProdukt.ListIndex = "0"
Me.cboAfaMethode.RowSource = ("H2:I6")
Me.cboAfaMethode.ListIndex = "0"
Me.cboGesperrt.RowSource = ("K2:K4")
Me.cboGesperrt.ListIndex = "0"
Worksheets("Kostenstellen").Activate
Me.cboKostenstelle.RowSource = ("A2:B393")
Me.cboKostenstelle.ListIndex = "0"
Worksheets("Gebäude").Activate
'Listenfeld einrichten
Dim r As Variant
ListBox1.ColumnCount = 31
r = Cells(65536, 2).End(xlUp).Row
ListBox1.RowSource = "A2:AE" & r
End Sub



Private Sub cmdDatenÄndern_Click()
' Aendern
If Zeile = "" Then Exit Sub
Cells(Zeile, 1) = txtlaufendeNummer.Value
Cells(Zeile, 2) = txtAnlagennummer.Value
Cells(Zeile, 3) = txtBeschreibung1.Value
Cells(Zeile, 4) = txtBeschreibung2.Value
Cells(Zeile, 5) = txtStandort.Value
Cells(Zeile, 6) = cboAnlagenklasse.Value
Cells(Zeile, 7) = cboAnlagensachgruppe.Value
Cells(Zeile, 8) = txtAnlagenbuchungsgruppe.Value
End Sub


Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
On Error GoTo 1
ListBox1.SetFocus
'tpk = 1
ListBox1.BoundColumn = 1
txtlaufendeNummer.Value = ListBox1.Value
ListBox1.BoundColumn = 2
txtAnlagennummer.Value = ListBox1.Value
ListBox1.BoundColumn = 5
txtStandort.Value = ListBox1.Value
ListBox1.BoundColumn = 3
txtBeschreibung1.Value = ListBox1.Value
ListBox1.BoundColumn = 4
txtBeschreibung2.Value = ListBox1.Value
ListBox1.BoundColumn = 6
cboAnlagenklasse.Value = ListBox1.Value
ListBox1.BoundColumn = 7
cboAnlagensachgruppe.Value = ListBox1.Value
ListBox1.BoundColumn = 9
cboKostenstelle.Value = ListBox1.Value
ListBox1.BoundColumn = 10
cboProdukt.Value = ListBox1.Value
ListBox1.BoundColumn = 13
txtSeriennummer.Value = ListBox1.Value
ListBox1.BoundColumn = 12
txtLieferantennummer.Value = ListBox1.Value
ListBox1.BoundColumn = 19
txtAnschaffungsjahr.Value = ListBox1.Value
txtAnschaffungsjahr2.Value = ListBox1.Value
ListBox1.BoundColumn = 8
txtAnlagenbuchungsgruppe.Value = ListBox1.Value
ListBox1.BoundColumn = 24
txtAnschaffungskosten.Value = ListBox1.Value
txtAnschaffungskosten2.Value = ListBox1.Value
ListBox1.BoundColumn = 16
txtStartdatumAfa.Value = ListBox1.Value
ListBox1.BoundColumn = 15
cboAfaMethode.Value = ListBox1.Value
ListBox1.BoundColumn = 17
txtAbschreibung.Value = ListBox1.Value
ListBox1.BoundColumn = 14
cboGesperrt.Value = ListBox1.Value
ListBox1.BoundColumn = 20
txtBelegdatum.Value = ListBox1.Value
ListBox1.BoundColumn = 21
txtBelegnummer.Value = ListBox1.Value
ListBox1.BoundColumn = 22
txtexterneBelegnummer.Value = ListBox1.Value
ListBox1.BoundColumn = 23
txtBeschreibung3.Value = ListBox1.Value
ListBox1.BoundColumn = 26
txtAnlagedatum.Value = ListBox1.Value
ListBox1.BoundColumn = 27
txtBelegdatum2.Value = ListBox1.Value
ListBox1.BoundColumn = 28
txtBelegnummer2.Value = ListBox1.Value
ListBox1.BoundColumn = 29
txtexterneBelegnummer2.Value = ListBox1.Value
ListBox1.BoundColumn = 30
txtBeschreibung4.Value = ListBox1.Value
ListBox1.BoundColumn = 31
txtjährlicherAbschreibungsbetrag.Value = ListBox1.Value
1:
End Sub

Anzeige
;

Forumthreads zu verwandten Themen

Anzeige
Anzeige
Anzeige
Anzeige
Entdecke relevante Threads

Schau dir verwandte Threads basierend auf dem aktuellen Thema an

Alle relevanten Threads mit Inhaltsvorschau entdecken

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Entdecke mehr
Finde genau, was du suchst

Die erweiterte Suchfunktion hilft dir, gezielt die besten Antworten zu finden

Suche nach den besten Antworten
Unsere beliebtesten Threads

Entdecke unsere meistgeklickten Beiträge in der Google Suche

Top 100 Threads jetzt ansehen
Anzeige