• DİKKAT

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

düşeyara makro kod yardım

İki Tarih arası için olanın kodları aşağıda Tek tarih için de Textbox5 in kodlarını aynı mantıkla değiştirmeniz gerekli.
Kod:
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim s1 As Worksheet
Set s1 = Sheets("Sayfa2")
Dim SonSatir As Long
SonSatir = s1.Range("L65536").End(xlUp).Row
If CheckBox5.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    ElseIf TextBox6.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox6.Text = Empty
        Exit Sub
    Else

    
        ilk_gün = Format(CDate(TextBox5.Text), "dd.mm.yyyy")
        son_gün = Format(CDate(TextBox6.Text), "dd.mm.yyyy")
        'Kredi Kartı
        If ComboBox1.Text = Empty Then
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
        Else
             For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(kki, "F").Value Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(nki, "F").Value Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(hki, "F").Value Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
        End If
    End If
End If
End Sub
 
İki Tarih arası için olanın kodları aşağıda Tek tarih için de Textbox5 in kodlarını aynı mantıkla değiştirmeniz gerekli.
Kod:
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim s1 As Worksheet
Set s1 = Sheets("Sayfa2")
Dim SonSatir As Long
SonSatir = s1.Range("L65536").End(xlUp).Row
If CheckBox5.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    ElseIf TextBox6.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox6.Text = Empty
        Exit Sub
    Else

    
        ilk_gün = Format(CDate(TextBox5.Text), "dd.mm.yyyy")
        son_gün = Format(CDate(TextBox6.Text), "dd.mm.yyyy")
        'Kredi Kartı
        If ComboBox1.Text = Empty Then
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
        Else
             For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(kki, "F").Value Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(nki, "F").Value Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(hki, "F").Value Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
        End If
    End If
End If
End Sub

çok teşekkür ederim askm hocam elinize sağlık. mükemmel çalışıyor. peki bu seçimlerde o tarih aralıklarında kaç personel bulunduğunu gösteren bir alan ya da kutucuk yapabilir miyiz acaba. Örnek olarak ekledim. bunlardan sonra son bir sıkıntım kalıyor. formu temizle butonunu yaptım. ancak diğer butonları kodlamayı beceremedim. daha doğrusu tecrübem yetmiyor. çok abarttınız diyeceksiniz biliyorum. Nasıl teşekkür etsem bilemedim size
 

Ekli dosyalar

Personel sayısı nereden alacak. CommandButton1 ve CommandButton3 ne işlem yapacak.Daha açık yazarsanız.
 
tarih seçtiğimizde o tarihte kaç tane işlem yapılmışsa onu sayması yeterli aslında. örnek 19.06.2017 tarihinde 3 kişi gelmiş kabul edelim onları sayması yeterli. bunun için ekstra command koymak gerekir mi? ben tarihleri enterladığımda otomatik oraya da yazar diye düşünüyordum. bir de raporla yazdır dediğimizde sadece user formdaki ekran gibi yeni bir excel sayfasına başlangıç tarihi ,bitiş tarihi, kişi sayısı, kredi kartı, cari, nakit toplam olarak yazması yeterli. ama firma bazlı olduğunda hangi tarihte kimin geldiği ve ne kadar nasıl ödediğini yazan bir excel raporlaması yapmasını istiyorum. Mümkün müdür acaba? örnek dosya tekrardan tarihleri düzenleyip ekledim
 

Ekli dosyalar

Personel sayısı için kodlar ekte. Diğeri için ayrıca bir sayfa eklemeniz gerekli. Sayfa şablonunu oluşturursanız ilgili verileri çektiririz.
Kod:
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim s1 As Worksheet
Set s1 = Sheets("Sayfa2")
Dim SonSatir As Long
Dim adet As Integer
SonSatir = s1.Range("L65536").End(xlUp).Row
adet = 0
If CheckBox5.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    ElseIf TextBox6.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox6.Text = Empty
        Exit Sub
    Else

    
        ilk_gün = Format(CDate(TextBox5.Text), "dd.mm.yyyy")
        son_gün = Format(CDate(TextBox6.Text), "dd.mm.yyyy")
        'Kredi Kartı
        If ComboBox1.Text = Empty Then
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                    adet = adet + 1
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
            TextBox7.Text = adet
        Else
             For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(kki, "F").Value Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(nki, "F").Value Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(hki, "F").Value Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                    adet = adet + 1
                End If
            Next hki
            
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
            TextBox7.Text = adet
        End If
    End If
End If
End Sub
 
Personel sayısı için kodlar ekte. Diğeri için ayrıca bir sayfa eklemeniz gerekli. Sayfa şablonunu oluşturursanız ilgili verileri çektiririz.
Kod:
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim s1 As Worksheet
Set s1 = Sheets("Sayfa2")
Dim SonSatir As Long
Dim adet As Integer
SonSatir = s1.Range("L65536").End(xlUp).Row
adet = 0
If CheckBox5.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    ElseIf TextBox6.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox6.Text = Empty
        Exit Sub
    Else

    
        ilk_gün = Format(CDate(TextBox5.Text), "dd.mm.yyyy")
        son_gün = Format(CDate(TextBox6.Text), "dd.mm.yyyy")
        'Kredi Kartı
        If ComboBox1.Text = Empty Then
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                    adet = adet + 1
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
            TextBox7.Text = adet
        Else
             For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(kki, "F").Value Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(nki, "F").Value Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(hki, "F").Value Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                    adet = adet + 1
                End If
            Next hki
            
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
            TextBox7.Text = adet
        End If
    End If
End If
End Sub

istediğiniz sayfaları ekleyip tekrar ekledim.
 

Ekli dosyalar

Örnek veri de ekleseniz. Firma Bazlı da hangi sayfadan veri alınacak. Siz formu sayfa2 ye göre yapıyorsunuz ama sayfa2 de istediğiniz bilgiler yok.
 
Örnek veri de ekleseniz. Firma Bazlı da hangi sayfadan veri alınacak. Siz formu sayfa2 ye göre yapıyorsunuz ama sayfa2 de istediğiniz bilgiler yok.

örnek dosya ekledim askm hocam. sayfa 2 de bahsettiğim bilgilerin hepsi var aslında. tc no isim soyisim firma ismi fiyat bilgileri ve tarih. isterseniz son eklediğim dosyadan bir bakın eklemem gerekn bişey varsa hemen ekleyeyim. teşekkürler tekrardan
 

Ekli dosyalar

İki Tarih arası için olanın kodları aşağıda Tek tarih için de Textbox5 in kodlarını aynı mantıkla değiştirmeniz gerekli.
Kod:
Private Sub TextBox6_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim s1 As Worksheet
Set s1 = Sheets("Sayfa2")
Dim SonSatir As Long
SonSatir = s1.Range("L65536").End(xlUp).Row
If CheckBox5.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    ElseIf TextBox6.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox6.Text = Empty
        Exit Sub
    Else

    
        ilk_gün = Format(CDate(TextBox5.Text), "dd.mm.yyyy")
        son_gün = Format(CDate(TextBox6.Text), "dd.mm.yyyy")
        'Kredi Kartı
        If ComboBox1.Text = Empty Then
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
        Else
             For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(kki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(kki, "F").Value Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(nki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(nki, "F").Value Then
                    nks = CDbl(s1.Cells(nki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ilk_gün) And CDate(s1.Cells(hki, "L").Value) <= CDate(son_gün) And ComboBox1.Text = s1.Cells(hki, "F").Value Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
            TextBox4.Value = Format(Val(TextBox1.Value) + Val(TextBox2.Value) + Val(TextBox3.Value), "Currency")
        End If
    End If
End If
End Sub
bu arada textbox5 kodlarını değiştiriyorum ancak firma bazlı arama yapmıyor. sanırım bir yerde hata yapıyorum. hata da vermiyor sadece normal işlemini yapıyor. firmayı dikkate almadan yapıyor.
 
Dosyayı indirmeye izin vermiyor. Tekrar yükleme imkanınız var mı?
 
Textbox5 kodları aşağıdaki şekilde.
Kod:
Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim s1 As Worksheet
Dim firma As String
Set s1 = Sheets("Sayfa2")
Dim SonSatir As Long
SonSatir = s1.Range("F65536").End(xlUp).Row
If ComboBox1.Text <> Empty Then
    firma = ComboBox1.Text
If CheckBox5.Value = True Then
    Exit Sub
ElseIf CheckBox4.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        'Kredi Kartı
        TextBox1.Text = Format(WorksheetFunction.SumIfs(s1.Range("J2:J" & SonSatir), s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("F2:F" & SonSatir), ComboBox1.Text), "Currency")
        'Nakit
        TextBox2.Text = Format(WorksheetFunction.SumIfs(s1.Range("I2:I" & SonSatir), s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("F2:F" & SonSatir), ComboBox1.Text), "Currency")
        'Hesap Kartı
        TextBox3.Text = Format(WorksheetFunction.SumIfs(s1.Range("K2:K" & SonSatir), s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("F2:F" & SonSatir), ComboBox1.Text), "Currency")
    End If
ElseIf CheckBox2.Value = True Then
    If TextBox5.TextLength <> 7 Then
        MsgBox "Lütfen Tarih formatını aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        ayin_ilk_günü = Format(DateValue("01." & Left(TextBox5.Text, 2) & "." & Mid(TextBox5.Text, 4, 7)), "dd.mm.yyyy")
        ayin_son_günü = CDate(WorksheetFunction.EoMonth(CDate(ayin_ilk_günü), 0))
        'Kredi Kartı
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(kki, "L").Value) <= CDate(ayin_son_günü) And s1.Cells(kki, "F").Value = firma Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(nki, "L").Value) <= CDate(ayin_son_günü) And s1.Cells(nki, "F").Value = firma Then
                    nks = CDbl(s1.Cells(kki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(hki, "L").Value) <= CDate(ayin_son_günü) And s1.Cells(hki, "F").Value = firma Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
    End If
ElseIf CheckBox3.Value = True Then
    If TextBox5.TextLength <> 4 Then
        MsgBox "Lütfen Tarih formatını yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        yil_ilk_g = Format(DateValue("01.01." & TextBox5.Text), "dd.mm.yyyy")
        yil_son_g = Format(DateValue("31.12." & TextBox5.Text), "dd.mm.yyyy")
        
        'Kredi Kartı
            For kkyi = 2 To SonSatir
                If CDate(s1.Cells(kkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(kkyi, "L").Value) <= CDate(yil_son_g) And s1.Cells(kkyi, "F").Value = firma Then
                    kkys = CDbl(s1.Cells(kkyi, "J")) + kkys
                End If
            Next kkyi
            TextBox1.Text = Format(kkys, "Currency")
        'Nakit
             For nkyi = 2 To SonSatir
                If CDate(s1.Cells(nkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(nkyi, "L").Value) <= CDate(yil_son_g) And s1.Cells(nkyi, "F").Value = firma Then
                    nkys = CDbl(s1.Cells(nkyi, "I")) + nkys
                End If
            Next nkyi
            TextBox2.Text = Format(nkys, "Currency")
        'Hesap Kartı
            For hkyi = 2 To SonSatir
                If CDate(s1.Cells(hkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(hkyi, "L").Value) <= CDate(yil_son_g) And s1.Cells(hkyi, "F").Value = firma Then
                    hkys = CDbl(s1.Cells(hkyi, "K")) + hkys
                End If
            Next hkyi
            TextBox3.Text = Format(hkys, "Currency")
    End If
End If
    
Else 'Firma


If CheckBox5.Value = True Then
    Exit Sub
ElseIf CheckBox4.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        'Kredi Kartı
        TextBox1.Text = Format(WorksheetFunction.SumIf(s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("J2:J" & SonSatir)), "Currency")
        'Nakit
        TextBox2.Text = Format(WorksheetFunction.SumIf(s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("I2:I" & SonSatir)), "Currency")
        'Hesap Kartı
        TextBox3.Text = Format(WorksheetFunction.SumIf(s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("K2:K" & SonSatir)), "Currency")
    End If
ElseIf CheckBox2.Value = True Then
    If TextBox5.TextLength <> 7 Then
        MsgBox "Lütfen Tarih formatını aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        ayin_ilk_günü = Format(DateValue("01." & Left(TextBox5.Text, 2) & "." & Mid(TextBox5.Text, 4, 7)), "dd.mm.yyyy")
        ayin_son_günü = CDate(WorksheetFunction.EoMonth(CDate(ayin_ilk_günü), 0))
        'Kredi Kartı
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(kki, "L").Value) <= CDate(ayin_son_günü) Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(nki, "L").Value) <= CDate(ayin_son_günü) Then
                    nks = CDbl(s1.Cells(kki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(hki, "L").Value) <= CDate(ayin_son_günü) Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
    End If
ElseIf CheckBox3.Value = True Then
    If TextBox5.TextLength <> 4 Then
        MsgBox "Lütfen Tarih formatını yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        yil_ilk_g = Format(DateValue("01.01." & TextBox5.Text), "dd.mm.yyyy")
        yil_son_g = Format(DateValue("31.12." & TextBox5.Text), "dd.mm.yyyy")
        
        'Kredi Kartı
            For kkyi = 2 To SonSatir
                If CDate(s1.Cells(kkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(kkyi, "L").Value) <= CDate(yil_son_g) Then
                    kkys = CDbl(s1.Cells(kkyi, "J")) + kkys
                End If
            Next kkyi
            TextBox1.Text = Format(kkys, "Currency")
        'Nakit
             For nkyi = 2 To SonSatir
                If CDate(s1.Cells(nkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(nkyi, "L").Value) <= CDate(yil_son_g) Then
                    nkys = CDbl(s1.Cells(nkyi, "I")) + nkys
                End If
            Next nkyi
            TextBox2.Text = Format(nkys, "Currency")
        'Hesap Kartı
            For hkyi = 2 To SonSatir
                If CDate(s1.Cells(hkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(hkyi, "L").Value) <= CDate(yil_son_g) Then
                    hkys = CDbl(s1.Cells(hkyi, "K")) + hkys
                End If
            Next hkyi
            TextBox3.Text = Format(hkys, "Currency")
    End If
End If

'ElseIf CheckBox5.Value = True Then
'    If TextBox5.TextLength <> 10 Then
'        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
'        TextBox5.Text = Empty
'    End If
'    If TextBox6.TextLength <> 10 Then
'        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
'        TextBox5.Text = Empty
'    End If
'Else
'MsgBox "CheckBox lardan birini işaretlemediniz. Lütfen önce kriter işaretlemesi yapınız.", vbInformation, "ASKM"
End If
End Sub
 
Textbox5 kodları aşağıdaki şekilde.
Kod:
Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim s1 As Worksheet
Dim firma As String
Set s1 = Sheets("Sayfa2")
Dim SonSatir As Long
SonSatir = s1.Range("F65536").End(xlUp).Row
If ComboBox1.Text <> Empty Then
    firma = ComboBox1.Text
If CheckBox5.Value = True Then
    Exit Sub
ElseIf CheckBox4.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        'Kredi Kartı
        TextBox1.Text = Format(WorksheetFunction.SumIfs(s1.Range("J2:J" & SonSatir), s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("F2:F" & SonSatir), ComboBox1.Text), "Currency")
        'Nakit
        TextBox2.Text = Format(WorksheetFunction.SumIfs(s1.Range("I2:I" & SonSatir), s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("F2:F" & SonSatir), ComboBox1.Text), "Currency")
        'Hesap Kartı
        TextBox3.Text = Format(WorksheetFunction.SumIfs(s1.Range("K2:K" & SonSatir), s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("F2:F" & SonSatir), ComboBox1.Text), "Currency")
    End If
ElseIf CheckBox2.Value = True Then
    If TextBox5.TextLength <> 7 Then
        MsgBox "Lütfen Tarih formatını aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        ayin_ilk_günü = Format(DateValue("01." & Left(TextBox5.Text, 2) & "." & Mid(TextBox5.Text, 4, 7)), "dd.mm.yyyy")
        ayin_son_günü = CDate(WorksheetFunction.EoMonth(CDate(ayin_ilk_günü), 0))
        'Kredi Kartı
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(kki, "L").Value) <= CDate(ayin_son_günü) And s1.Cells(kki, "F").Value = firma Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(nki, "L").Value) <= CDate(ayin_son_günü) And s1.Cells(nki, "F").Value = firma Then
                    nks = CDbl(s1.Cells(kki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(hki, "L").Value) <= CDate(ayin_son_günü) And s1.Cells(hki, "F").Value = firma Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
    End If
ElseIf CheckBox3.Value = True Then
    If TextBox5.TextLength <> 4 Then
        MsgBox "Lütfen Tarih formatını yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        yil_ilk_g = Format(DateValue("01.01." & TextBox5.Text), "dd.mm.yyyy")
        yil_son_g = Format(DateValue("31.12." & TextBox5.Text), "dd.mm.yyyy")
        
        'Kredi Kartı
            For kkyi = 2 To SonSatir
                If CDate(s1.Cells(kkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(kkyi, "L").Value) <= CDate(yil_son_g) And s1.Cells(kkyi, "F").Value = firma Then
                    kkys = CDbl(s1.Cells(kkyi, "J")) + kkys
                End If
            Next kkyi
            TextBox1.Text = Format(kkys, "Currency")
        'Nakit
             For nkyi = 2 To SonSatir
                If CDate(s1.Cells(nkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(nkyi, "L").Value) <= CDate(yil_son_g) And s1.Cells(nkyi, "F").Value = firma Then
                    nkys = CDbl(s1.Cells(nkyi, "I")) + nkys
                End If
            Next nkyi
            TextBox2.Text = Format(nkys, "Currency")
        'Hesap Kartı
            For hkyi = 2 To SonSatir
                If CDate(s1.Cells(hkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(hkyi, "L").Value) <= CDate(yil_son_g) And s1.Cells(hkyi, "F").Value = firma Then
                    hkys = CDbl(s1.Cells(hkyi, "K")) + hkys
                End If
            Next hkyi
            TextBox3.Text = Format(hkys, "Currency")
    End If
End If
    
Else 'Firma


If CheckBox5.Value = True Then
    Exit Sub
ElseIf CheckBox4.Value = True Then
    If TextBox5.TextLength <> 10 Then
        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        'Kredi Kartı
        TextBox1.Text = Format(WorksheetFunction.SumIf(s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("J2:J" & SonSatir)), "Currency")
        'Nakit
        TextBox2.Text = Format(WorksheetFunction.SumIf(s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("I2:I" & SonSatir)), "Currency")
        'Hesap Kartı
        TextBox3.Text = Format(WorksheetFunction.SumIf(s1.Range("L2:L" & SonSatir), CDate(TextBox5.Text), s1.Range("K2:K" & SonSatir)), "Currency")
    End If
ElseIf CheckBox2.Value = True Then
    If TextBox5.TextLength <> 7 Then
        MsgBox "Lütfen Tarih formatını aa.yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        ayin_ilk_günü = Format(DateValue("01." & Left(TextBox5.Text, 2) & "." & Mid(TextBox5.Text, 4, 7)), "dd.mm.yyyy")
        ayin_son_günü = CDate(WorksheetFunction.EoMonth(CDate(ayin_ilk_günü), 0))
        'Kredi Kartı
            For kki = 2 To SonSatir
                If CDate(s1.Cells(kki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(kki, "L").Value) <= CDate(ayin_son_günü) Then
                    kks = CDbl(s1.Cells(kki, "J")) + kks
                End If
            Next kki
            TextBox1.Text = Format(kks, "Currency")
        'Nakit
             For nki = 2 To SonSatir
                If CDate(s1.Cells(nki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(nki, "L").Value) <= CDate(ayin_son_günü) Then
                    nks = CDbl(s1.Cells(kki, "I")) + nks
                End If
            Next nki
            TextBox2.Text = Format(nks, "Currency")
        'Hesap Kartı
            For hki = 2 To SonSatir
                If CDate(s1.Cells(hki, "L").Value) >= CDate(ayin_ilk_günü) And CDate(s1.Cells(hki, "L").Value) <= CDate(ayin_son_günü) Then
                    hks = CDbl(s1.Cells(hki, "K")) + hks
                End If
            Next hki
            TextBox3.Text = Format(hks, "Currency")
    End If
ElseIf CheckBox3.Value = True Then
    If TextBox5.TextLength <> 4 Then
        MsgBox "Lütfen Tarih formatını yyyy şeklinde giriniz"
        TextBox5.Text = Empty
    Else
        yil_ilk_g = Format(DateValue("01.01." & TextBox5.Text), "dd.mm.yyyy")
        yil_son_g = Format(DateValue("31.12." & TextBox5.Text), "dd.mm.yyyy")
        
        'Kredi Kartı
            For kkyi = 2 To SonSatir
                If CDate(s1.Cells(kkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(kkyi, "L").Value) <= CDate(yil_son_g) Then
                    kkys = CDbl(s1.Cells(kkyi, "J")) + kkys
                End If
            Next kkyi
            TextBox1.Text = Format(kkys, "Currency")
        'Nakit
             For nkyi = 2 To SonSatir
                If CDate(s1.Cells(nkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(nkyi, "L").Value) <= CDate(yil_son_g) Then
                    nkys = CDbl(s1.Cells(nkyi, "I")) + nkys
                End If
            Next nkyi
            TextBox2.Text = Format(nkys, "Currency")
        'Hesap Kartı
            For hkyi = 2 To SonSatir
                If CDate(s1.Cells(hkyi, "L").Value) >= CDate(yil_ilk_g) And CDate(s1.Cells(hkyi, "L").Value) <= CDate(yil_son_g) Then
                    hkys = CDbl(s1.Cells(hkyi, "K")) + hkys
                End If
            Next hkyi
            TextBox3.Text = Format(hkys, "Currency")
    End If
End If

'ElseIf CheckBox5.Value = True Then
'    If TextBox5.TextLength <> 10 Then
'        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
'        TextBox5.Text = Empty
'    End If
'    If TextBox6.TextLength <> 10 Then
'        MsgBox "Lütfen Tarih formatını gg.aa.yyyy şeklinde giriniz"
'        TextBox5.Text = Empty
'    End If
'Else
'MsgBox "CheckBox lardan birini işaretlemediniz. Lütfen önce kriter işaretlemesi yapınız.", vbInformation, "ASKM"
End If
End Sub

textbox 5 uyumlu bir şekilde çalıştı. sadece sayma işlemini yapmıyor. personel sayısı işlemi için textbox6 gibi yapmaya çalıştım ama olmadı.

****Sayma işlemini de textbox6 gibi uyarlayıp çözmeyi başardım. yukarıdaki yazdığımı dikkate almayın lütfen. teşekkürler
 
Son düzenleme:
Çözdüm yazdınız diye işlem yapmadım.
 
merhaba arkadaşlar,

programda tarihle ilgili bilgileri sayfa2den çekiyoruz. ama sayfayı yeni bir excel sayfasına kaydetmem gerekiyor. hem firma bazlı kayıt yapmam gerekiyor hem de sadece ciro bazlı. ancak command butonları kodlayamadım. yardımlarınızı bekliyorum
 
Firma bazlı ayrı Excel çıktısı mı yoksa farklı kayıt mı yapmak istiyorsunuz.
 
Firma bazlıda combobox1 ile veri süzdükten sonra bu kodları butona aktarırsanız çalışır.
Ciro kısmı da tarihlere göre işlem yapıyor.
Kod:
Sub Firma_aktar()
Dim SonSatir As Long
Dim s1, s2 As Worksheet
Set s1 = Sheets("Sayfa2")
Set s2 = Sheets("firma bazlı")
SonSatir = s1.Range("C65000").End(xlUp).Row
s2.Range("A2:H65000").ClearContents
s1.Range("A2:C" & SonSatir).SpecialCells(xlCellTypeVisible).Copy Destination:=s2.Range("A2")
s1.Range("H2:L" & SonSatir).SpecialCells(xlCellTypeVisible).Copy Destination:=s2.Range("D2")
End Sub

Sub Ciro_aktar()
Dim s1, s2 As Worksheet
Set s1 = Sheets("Sayfa2")
Set s2 = Sheets("ciro bazlı")
s2.Range("a2") = TextBox5.Text
s2.Range("b2") = TextBox5.Text
s2.Range("c2") = TextBox4.Text
s2.Range("d2") = TextBox2.Text
s2.Range("e2") = TextBox1.Text
s2.Range("f2") = TextBox3.Text
End Sub
 
Firma bazlıda combobox1 ile veri süzdükten sonra bu kodları butona aktarırsanız çalışır.
Ciro kısmı da tarihlere göre işlem yapıyor.
Kod:
Sub Firma_aktar()
Dim SonSatir As Long
Dim s1, s2 As Worksheet
Set s1 = Sheets("Sayfa2")
Set s2 = Sheets("firma bazlı")
SonSatir = s1.Range("C65000").End(xlUp).Row
s2.Range("A2:H65000").ClearContents
s1.Range("A2:C" & SonSatir).SpecialCells(xlCellTypeVisible).Copy Destination:=s2.Range("A2")
s1.Range("H2:L" & SonSatir).SpecialCells(xlCellTypeVisible).Copy Destination:=s2.Range("D2")
End Sub

Sub Ciro_aktar()
Dim s1, s2 As Worksheet
Set s1 = Sheets("Sayfa2")
Set s2 = Sheets("ciro bazlı")
s2.Range("a2") = TextBox5.Text
s2.Range("b2") = TextBox5.Text
s2.Range("c2") = TextBox4.Text
s2.Range("d2") = TextBox2.Text
s2.Range("e2") = TextBox1.Text
s2.Range("f2") = TextBox3.Text
End Sub

Askm hocam süpersiniz ellerinize sağlık. Yalnız firma bazlıda sayfa temizleme çalışmıyor hocam. bir kayıttan sonra manuel temizleme yapmamız gerekiyor. yani sayfada veri varken userformdan yeni bir şey arattığımda yazmıyor.
 
Geri
Üst