Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1104to1108
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

UserForm - TextBox

UserForm - TextBox
rolf
hallo
ich möchte in einer userform mit einer combobox und vielen textboxen einträge bearbeiten und in die jeweilige zelle zurückgeben.
aber sobald eine leerspalte dazwische ist werden die restlichen einträge nicht zurückgeschrieben.
frage
was kann ich tun damit alle einträge zurückgeschrieben werden.
https://www.herber.de/bbs/user/64860.xls
mfg rolf

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Benutzer
Anzeige
AW: UserForm - TextBox
05.10.2009 11:41:16
Erich
Hi Rolf,
die RowSpurce der ComboBox1 ist der Anfang der Spalte D.
Bei Änderung der ComboBox1 werden die Daten eingelesen - in ComboBox1_Change().
In CommandButton2_Click() wired auch ein Wert in Spalte D geschrieben:
Sheets("Tabelle1").Cells(wohin, 4) = Format(TextBox3.Text)
Damit wird dann ComboBox1_Change() ausgelöst, die Daten werden neue eingelesen, die Eingaben verfallen.
Man muss also dafür sorgen, dass das Zurückschreiben nicht unterbrochen wird,
mit anderen Worten: dass während des Zurückschreibens nicht neu eingelesen wird.
Das geht mit
Application.EnableEvents = False
Probiers mal mit

Private Sub CommandButton2_Click()        'EINTRAG BEARBEITEN
Dim wohin As Long
wohin = Me.ComboBox1.ListIndex + 2
Application.EnableEvents = False
With Sheets("Tabelle1").Rows(wohin)       ' in Blatt "Tabelle1", Zeile wohin
.Cells(1) = Format(TextBox2.Text)
.Cells(2) = Format(TextBox4.Text)
.Cells(3) = Format(TextBox5.Text)
.Cells(4) = Format(TextBox3.Text)
.Cells(6) = Format(TextBox6.Text)
.Cells(8) = Format(TextBox7.Text)
.Cells(9) = Format(TextBox8.Text)
.Cells(14) = Format(TextBox9.Text)
.Cells(12) = Format(TextBox10.Text)
.Cells(10) = Format(TextBox11.Text)
.Cells(16) = Format(TextBox12.Text)
.Cells(21) = Format(TextBox13.Text)
.Cells(19) = Format(TextBox14.Text)
.Cells(17) = Format(TextBox15.Text)
.Cells(32) = Format(TextBox16.Text)
.Cells(33) = Format(TextBox17.Text)
.Cells(36) = Format(TextBox18.Text)
.Cells(43) = Format(TextBox19.Text)
.Cells(39) = Format(TextBox20.Text)
.Cells(38) = Format(TextBox21.Text)
.Cells(35) = Format(TextBox22.Text)
.Cells(46) = Format(TextBox23.Text)
.Cells(41) = Format(TextBox24.Text)
.Cells(56) = Format(TextBox25.Text)
.Cells(59) = Format(TextBox26.Text)
.Cells(62) = Format(TextBox27.Text)
.Cells(91) = Format(TextBox28.Text)
.Cells(77) = Format(TextBox29.Text)
End With
ComboBox1.SetFocus
Application.EnableEvents = True
End Sub
Noch ein Tipp:
Du solltest dir angewöhnen, mit "Option Explicit" zu arbeiten.
Rückmeldung wäre nett! - Grüße von Erich aus Kamp-Lintfort
P.S.: Whi is "dkoch" ?
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige