AW: Einträge fortlaufend speichern
20.03.2010 20:07:11
Leo
Hmmm... ich versuchs, bekomm es aber net hin... Wo ist mein Denkfehler?
So siehts im Moment komplet aus:
Dim p As Long
Private Sub CommandButton1_Click()
If TextBox1.Text = "" Or _
TextBox2.Text = "" Or _
ComboBox1.Value = "" Or _
ComboBox2.Value = "" Or _
ComboBox3.Value = "" Or _
ComboBox4.Value = "" Or _
ComboBox5.Value = "" Then
MsgBox "Bitte alle Felder ausfüllen!", vbInformation, "Hinweis"
Exit Sub
End If
With Sheets("Verbrauchsliste")
If p = 0 Then p = IIf(IsEmpty(.Range("A65536")), .Range("A65536").End(xlUp).Row, 65536) _
+ 1
.Range("A" & p).Value = TextBox2.Text
TextBox2.Text = ""
.Range("B" & p).Value = ComboBox1.Text
ComboBox1.Text = ""
.Range("C" & p).Value = ComboBox2.Text
ComboBox2.Text = ""
.Range("D" & p).Value = ComboBox3.Text
ComboBox3.Text = ""
.Range("E" & p).Value = ComboBox4.Text
ComboBox4.Text = ""
.Range("F" & p).Value = ComboBox5.Text
ComboBox5.Text = ""
.Range("H" & p).Value = TextBox1.Text
TextBox1.Text = ""
'usw. für die restlichen ComboBoxen.
End With
End Sub
Private Sub ComboBox1_Change()
TextBox2 = Now
End Sub
Private Sub CommandButton2_Click()
If TextBox3.Text "geheim" Then
Application.Quit
Else
Unload Me
End If
End Sub
Private Sub Label1_Click()
End Sub
Private Sub Label12_Click()
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Label4_Click()
End Sub
Private Sub Label8_Click()
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim q As Long
q = ListBox1.ListCount
If ListBox1.ListIndex
Private Sub UserForm_Initialize()
Dim z As Integer
With Sheets("Listbox-Felder")
For z = 3 To .Cells(65536, 1).End(xlUp).Row
ComboBox1.AddItem .Cells(z, 1).Value
Next z
For z = 3 To .Cells(65536, 2).End(xlUp).Row
ComboBox2.AddItem .Cells(z, 2).Value
Next z
For z = 3 To .Cells(65536, 3).End(xlUp).Row
ComboBox3.AddItem .Cells(z, 3).Value
Next z
For z = 3 To .Cells(65536, 4).End(xlUp).Row
ComboBox4.AddItem .Cells(z, 4).Value
Next z
For z = 3 To .Cells(65536, 5).End(xlUp).Row
ComboBox5.AddItem .Cells(z, 5).Value
Next z
For z = 3 To .Cells(65536, 6).End(xlUp).Row
ComboBox6.AddItem .Cells(z, 6).Value
Next z
End With
With Sheets("Verbrauchsliste")
lz = .Cells(65536, 1).End(xlUp).Row
ListBox1.RowSource = .Range("A3:H" & lz).Address(External:=True)
ListBox1.ColumnHeads = True
End With
Me.Top = 0
Me.Left = 0
Me.Height = Application.Height
Me.Width = Application.Width
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If TextBox3.Text "geheim" Then Cancel = True
End Sub
Gruß, Leo