• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

ComboBox Sorunu

Sizdeki kodlar ile satır satır karşılaştırın hataları göreceksiniz.
Kod:
Private Sub CommandButton1_Click()
Dim i As Long
If ComboBox1.Value = "" Or ComboBox2.Value = "" Then
MsgBox "Please Choose Date", vbCritical, ""
Exit Sub
End If
Label1.Caption = ComboBox1.Value
Label2.Caption = ComboBox2.Value

ListBox1.Clear
For i = 2 To Sheets("Sayfa2").Range("a65536").End(3).Row
If VBA.CLng(VBA.CDate(Cells(i, "A").Value)) >= VBA.CLng(VBA.CDate(ComboBox1.Value)) And VBA.CLng(VBA.CDate(Cells(i, "A").Value)) <= VBA.CLng(VBA.CDate(ComboBox2.Value)) Then
With ListBox1
    .AddItem VBA.Format(Cells(i, 3).Value, "dd.mm.yyyy")
    .List(.ListCount - 1, 1) = Cells(i, 2).Value
    .List(.ListCount - 1, 2) = Cells(i, 4).Value
    .List(.ListCount - 1, 3) = Cells(i, 5).Value
     .List(.ListCount - 1, 4) = Cells(i, 6).Value
     .List(.ListCount - 1, 5) = Cells(i, 7).Value
     .List(.ListCount - 1, 6) = Cells(i, 8).Value
     .List(.ListCount - 1, 7) = Cells(i, 9).Value
      .List(.ListCount - 1, 8) = VBA.Format(Cells(i, 10).Value, "#,##0.00")
End With
End If
Next i
i = Empty
End Sub

Private Sub UserForm_Initialize()
Dim c As Variant, hcr As Range
Dim pk As Worksheet
ListBox1.ColumnCount = 8
ListBox1.ColumnWidths = "60,60,55,55,55,60,55,55"
ComboBox1.Clear
ComboBox2.Clear
Set pk = Sheets("Sayfa2")
With pk.Range("A2:D" & pk.Cells(Rows.Count, "A").End(xlUp).Row)
    .Sort Key1:=pk.Range("A2"), _
    Order1:=xlAscending, _
    Header:=xlNo, _
    OrderCustom:=1, _
    MatchCase:=False, _
    Orientation:=xlTopToBottom, _
    DataOption1:=xlSortTextAsNumbers
End With
With CreateObject("Scripting.Dictionary")
For Each hcr In pk.Range("A2:A" & pk.Cells(65536, "A").End(xlUp).Row)
If Not .exists(hcr.Value) Then
.Add VBA.Format(hcr.Value, "dd.mm.yyyy"), Nothing
End If
Next hcr
c = .keys
End With
ComboBox1.List = c
ComboBox2.List = c
End Sub
 
Son düzenleme:
Geri
Üst