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

Textbox - Eintrag aus anerem Arbeitsblatt

Forumthread: Textbox - Eintrag aus anerem Arbeitsblatt

Textbox - Eintrag aus anerem Arbeitsblatt
03.09.2007 13:41:32
roger
Hallo, nun habe ich es bald! Nachdem der Code nun wirklich super funktioniert, brauche ich noch dass die Daten aus einem anderen Arbeitsblatt ein- und ausgelesen werden als die Eingabemaske erscheint. Das Heisst wenn die Eingabemaske auf Tabelle 1 erscheint, sollen die Werte von Tabelle 2 gelesen und eingetragen werden.
Vielen Dank
Option Explicit

Private Sub ComboBox1_Click()
If ComboBox1.ListIndex  0 Then
TextBox1 = Cells(ComboBox1.ListIndex + 1, 4)
TextBox1 = Replace(TextBox1.Value, ",", ".")
TextBox2 = Cells(ComboBox1.ListIndex + 1, 5)
TextBox2 = Replace(TextBox2.Value, ",", ".")
TextBox3 = Cells(ComboBox1.ListIndex + 1, 6)
TextBox3 = Replace(TextBox3.Value, ",", ".")
TextBox4 = Cells(ComboBox1.ListIndex + 1, 7)
TextBox4 = Replace(TextBox4.Value, ",", ".")
TextBox5 = Cells(ComboBox1.ListIndex + 1, 8)
TextBox5 = Replace(TextBox5.Value, ",", ".")
TextBox6 = Cells(ComboBox1.ListIndex + 1, 9)
TextBox6 = Replace(TextBox6.Value, ",", ".")
TextBox7 = Cells(ComboBox1.ListIndex + 1, 10)
TextBox7 = Replace(TextBox7.Value, ",", ".")
TextBox8 = Cells(ComboBox1.ListIndex + 1, 1)
Else
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
End If
End Sub



Private Sub CommandButton1_Click()
If ComboBox1.ListIndex > 0 Then
Rows(ComboBox1.ListIndex + 1).Delete
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
UserForm_Initialize
End If
End Sub



Private Sub CommandButton2_Click()
Dim xZeile As Long
If TextBox1 = "" Then Exit Sub
If ComboBox1.ListIndex = 0 Then
xZeile = [D65536].End(xlUp).Row + 1
Else
xZeile = ComboBox1.ListIndex + 1
End If
Cells(xZeile, 4) = (TextBox1)
Cells(xZeile, 5) = (TextBox2)
Cells(xZeile, 6) = (TextBox3)
Cells(xZeile, 7) = (TextBox4)
Cells(xZeile, 8) = (TextBox5)
Cells(xZeile, 9) = (TextBox6)
Cells(xZeile, 10) = (TextBox7)
Cells(xZeile, 1) = CDate(TextBox8)
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
TextBox4 = ""
TextBox5 = ""
TextBox6 = ""
TextBox7 = ""
TextBox8 = ""
Columns("A:I").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
UserForm_Initialize
End Sub



Private Sub CommandButton3_Click()
Unload Me
End Sub



Private Sub TextBox1_Change()
End Sub



Private Sub TextBox8_Change()
End Sub



Private Sub UserForm_Initialize()
Dim aRow, i As Long
Application.EnableEvents = False
ComboBox1.Clear
aRow = [D65536].End(xlUp).Row
ComboBox1.AddItem "choose Date"
For i = 2 To aRow
ComboBox1.AddItem Cells(i, 1)
Next i
ComboBox1.ListIndex = 0
Application.EnableEvents = True
End Sub


Anzeige

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Textbox - Eintrag aus anerem Arbeitsblatt
03.09.2007 14:35:00
Rudi
Hallo,
als Anstoß:

Private Sub ComboBox1_Click()
If ComboBox1.ListIndex  0 Then
With Sheets("Tabelle2")
TextBox1 = .Cells(ComboBox1.ListIndex + 1, 4)
TextBox1 = Replace(TextBox1.Value, ",", ".")
TextBox2 = .Cells(ComboBox1.ListIndex + 1, 5)
TextBox2 = Replace(TextBox2.Value, ",", ".")
TextBox3 = .Cells(ComboBox1.ListIndex + 1, 6)
TextBox3 = Replace(TextBox3.Value, ",", ".")
TextBox4 = .Cells(ComboBox1.ListIndex + 1, 7)
TextBox4 = Replace(TextBox4.Value, ",", ".")
TextBox5 = .Cells(ComboBox1.ListIndex + 1, 8)
TextBox5 = Replace(TextBox5.Value, ",", ".")
TextBox6 = .Cells(ComboBox1.ListIndex + 1, 9)
TextBox6 = Replace(TextBox6.Value, ",", ".")
TextBox7 = .Cells(ComboBox1.ListIndex + 1, 10)
TextBox7 = Replace(TextBox7.Value, ",", ".")
TextBox8 = .Cells(ComboBox1.ListIndex + 1, 1)
End With


Gruß
Rudi
Eine Kuh macht Muh, viele Kühe machen Mühe

Anzeige
AW: Textbox - Eintrag aus anerem Arbeitsblatt
03.09.2007 17:10:00
roger
Funktioniert leider nicht. Es werden immer noch die Daten der ersten Spalte eingelesen, wo die Eingabemaske auch erscheint.

AW: Textbox - Frage noch offen
03.09.2007 17:16:37
roger
Die Frage ist noch offen

AW: Textbox - Frage noch offen
03.09.2007 18:05:00
Uduuh
Hallo,
hast du jeweils auch den . (Punkt) vor Cells?
Ansonsten erscheint mir der Code richtig.
Gruß aus’m Pott
Udo

Anzeige
AW: Textbox - Frage noch offen
03.09.2007 18:14:00
roger
Ja, habe ich gemacht (.). Geht leider nicht. Hast Du Dir mal den ganzen Code angesehen? Muss ich nicht noch an anderen Orten den Code verändern?
Vielen Dank,
Roger
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige