- Katılım
- 4 Haziran 2005
- Mesajlar
- 2,746
- Excel Vers. ve Dili
- 2010-2016
İ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
