Da bin ich schon wieder und brauche noch mal eure Hilfe für Excel und VB6
Zwei Sachen bekomme ich noch nicht in die reihe.
Das erste ist wie kann ich die nächste leere Celle ansprechen.
Über VBA habe ich was gefunden, aber das geht nicht mit VB6.
In einer ListBox schreibe ich was das ich dann in Spalte? leere Celle übergeben möchte.
Das zweite ist.
Ich lese über eine ListBox in einer Spalte die Termine ein
Die Termine stehen in unterschiedlichen Cellen.
Durch DblClick öffne ich eine zweite Form und gebe dort Daten ein die dann
In der gleichen Zeile geschrieben werden sollen.
Leider werden die Daten auch in unterschiedlichen Zeilen geschrieben.
Lese ich alles ein dann geht es.
Ich brauche noch die zwei sachen dann ist meine Arbeit fertig.
Private Sub Termin_listen()
Dim X&
List1.Clear
List2.Clear
List3.Clear
List4.Clear
List5.Clear
List6.Clear
List7.Clear
For X = 4 To 600
If LCase(Excel.Cells(X, 4)) = "termin" Then
List1.AddItem Excel.Cells(X, 3)
List2.AddItem Excel.Cells(X, 7)
List3.AddItem Excel.Cells(X, 8)
List4.AddItem Excel.Cells(X, 2)
List5.AddItem Excel.Cells(X, 1)
List6.AddItem Excel.Cells(X, 11)
List7.AddItem Excel.Cells(X, 12)
End If
Next
End Sub
Private Sub Alle_Kunden()
Dim X&
List1.Clear
List2.Clear
List3.Clear
List4.Clear
List5.Clear
List6.Clear
List7.Clear
For X = 4 To 600
List1.AddItem (Excel.Cells(X, 5))
List2.AddItem (Excel.Cells(X, 7))
List3.AddItem (Excel.Cells(X, 8))
List4.AddItem (Excel.Cells(X, 2))
List5.AddItem (Excel.Cells(X, 1))
List6.AddItem (Excel.Cells(X, 11))
List7.AddItem (Excel.Cells(X, 12))
Next
End Sub
Private Sub List2_DblClick()
Dim Li%
Dim i As Integer
Li = List2.ListIndex + 4
With Excel.Cells
Form2.Text1.Text = .Cells(Li, 7)
Form2.Text2.Text = .Cells(Li, 8)
Form2.Text3.Text = .Cells(Li, 9)
Form2.Text4.Text = .Cells(Li, 10)
Form2.Text5.Text = .Cells(Li, 13)
Form2.Text14.Text = .Cells(Li, 14)
Form2.Text6.Text = .Cells(Li, 15)
Form2.Text7.Text = .Cells(Li, 16)
Form2.Text19.Text = .Cells(Li, 17)
Form2.Text8.Text = .Cells(Li, 17)
Form2.Text9.Text = .Cells(Li, 18)
Form2.Text10.Text = .Cells(Li, 19)
Form2.Text11.Text = .Cells(Li, 20)
Form2.Text12.Text = .Cells(Li, 21)
Form2.Text13.Text = .Cells(Li, 22)
Form2.Text15.Text = .Cells(Li, 11)
Form2.Text16.Text = .Cells(Li, 12)
Form2.Combo1.Text = .Cells(Li, 1)
Form2.Combo2.Text = .Cells(Li, 2)
Form2.lstItems.Clear
Form2.List2.Clear
Form2.List3.Clear
Form2.List4.Clear
Form2.List5.Clear
For i = 23 To 50 Step 5
If .Cells(Li, i) <> "" Then Form2.lstItems.AddItem .Cells(Li, i)
If .Cells(Li, i + 1) <> "" Then Form2.List2.AddItem .Cells(Li, i + 1)
If .Cells(Li, i + 2) <> "" Then Form2.List3.AddItem .Cells(Li, i + 2)
If .Cells(Li, i + 3) <> "" Then Form2.List4.AddItem .Cells(Li, i + 3)
If .Cells(Li, i + 4) <> "" Then Form2.List5.AddItem .Cells(Li, i + 4)
Next
End With
Form2.Visible = True
End Sub
Form2:
Case "Speichern"
Dim F As Integer
Dim X As Integer
Dim Li%
Li = Form1.List2.ListIndex + 4
Excel.Cells(Li, 7).Value = Text1.Text
Excel.Cells(Li, 8).Value = Text2.Text
Excel.Cells(Li, 9).Value = Text3.Text
Excel.Cells(Li, 10).Value = Text4.Text
Excel.Cells(Li, 13).Value = Text5.Text
Excel.Cells(Li, 14).Value = Text14.Text
Excel.Cells(Li, 15).Value = Text6.Text
Excel.Cells(Li, 16).Value = Text7.Text
Excel.Cells(Li, 17).Value = Text19.Text
Excel.Cells(Li, 18).Value = Text9.Text
Excel.Cells(Li, 19).Value = Text10.Text
Excel.Cells(Li, 20).Value = Text11.Text
Excel.Cells(Li, 21).Value = Text12.Text
Excel.Cells(Li, 22).Value = Text13.Text
Excel.Cells(Li, 11).Value = Text15.Text
Excel.Cells(Li, 12).Value = Text16.Text
Excel.Cells(Li, 1).Value = Combo1.Text
Excel.Cells(Li, 2).Value = Combo2.Text
For X = 23 To 50 Step 5
For F = 0 To lstItems.Container - 1
Excel.Cells(Li, X).Value = lstItems.List(F)
Excel.Cells(Li, X + 1).Value = List2.List(F)
Excel.Cells(Li, X + 2).Value = List3.List(F)
Excel.Cells(Li, X + 3).Value = List4.List(F)
Excel.Cells(Li, X + 4).Value = List5.List(F)
Next