DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Private Sub TextBox22_Change()
Dim Nesne As Control
TextBox22.BackColor = vbGreen
If TextBox22 = "" Then
TextBox21 = ""
TextBox23 = ""
TextBox24 = ""
TextBox1 = ""
TextBox2 = ""
TextBox3 = ""
Label56.Caption = ""
Label57.Caption = ""
End If
If Len(TextBox22) = 6 Then
TextBox23.SetFocus
If Not IsNumeric(Replace(Replace(Replace(TextBox22.Text, "(", ""), ")", ""), " ", "")) Then
TextBox22.SetFocus
TextBox22.SelStart = 0
TextBox22.SelLength = Len(TextBox22.Text)
End If
Dim bul
On Error Resume Next
bul = Sheets("VERİ").Range("B2:B100000").Find(What:=TextBox22, LookIn:=xlValues, lookat:=xlWhole).Row
TextBox21.Value = Sheets("VERİ").Cells(bul, 1).Value
TextBox23.Value = Sheets("VERİ").Cells(bul, 3).Value
TextBox24.Value = Sheets("VERİ").Cells(bul, 4).Value
TextBox1.Text = Sheets("VERİ").Cells(bul, 5).Value
TextBox2.Text = Sheets("VERİ").Cells(bul, 6).Value
TextBox3.Text = Sheets("VERİ").Cells(bul, 7).Value
If TextBox1 = "" Then
MsgBox "Başlangıç boş!", vbCritical
ElseIf TextBox2 = "" Then
Label56.Caption = Format((CDate(Date) - CDate(TextBox1)) / (TextBox3 * 365) * 100, "% 0.00")
Yil = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""y"")")
Ay = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""ym"")")
Gun = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""md"")")
Label57.Caption = Yil & " Yıl " & Ay & " Ay " & Gun & " Gün"
Else
Label56.Caption = Format((CDate(TextBox2) - CDate(TextBox1)) / (TextBox3 * 365) * 100, "% 0.00")
Yil = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(TextBox2)) & ",""y"")")
Ay = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(TextBox2)) & ",""ym"")")
Gun = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(TextBox2)) & ",""md"")")
Label57.Caption = Yil & " Yıl " & Ay & " Ay " & Gun & " Gün"
End If
End If
End Sub
Hocam 7 numaralı kayıt 3 yıl 0 ay 0 gün olursa tam doğru oluyor mal3sef resimde 7 numaralı kayıt yüzde yüz iken geçen zmaan 2 yıl 1 ay 9 gün oluyorDeneyiniz.
Ben bu kodlar ile resimdeki sonuçları alıyorum.
C++:Private Sub TextBox22_Change() Dim Nesne As Control TextBox22.BackColor = vbGreen If TextBox22 = "" Then TextBox21 = "" TextBox23 = "" TextBox24 = "" TextBox1 = "" TextBox2 = "" TextBox3 = "" Label56.Caption = "" Label57.Caption = "" End If If Len(TextBox22) = 6 Then TextBox23.SetFocus If Not IsNumeric(Replace(Replace(Replace(TextBox22.Text, "(", ""), ")", ""), " ", "")) Then TextBox22.SetFocus TextBox22.SelStart = 0 TextBox22.SelLength = Len(TextBox22.Text) End If Dim bul On Error Resume Next bul = Sheets("VERİ").Range("B2:B100000").Find(What:=TextBox22, LookIn:=xlValues, lookat:=xlWhole).Row TextBox21.Value = Sheets("VERİ").Cells(bul, 1).Value TextBox23.Value = Sheets("VERİ").Cells(bul, 3).Value TextBox24.Value = Sheets("VERİ").Cells(bul, 4).Value TextBox1.Text = Sheets("VERİ").Cells(bul, 5).Value TextBox2.Text = Sheets("VERİ").Cells(bul, 6).Value TextBox3.Text = Sheets("VERİ").Cells(bul, 7).Value If TextBox1 = "" Then MsgBox "Başlangıç boş!", vbCritical ElseIf TextBox2 = "" Then Label56.Caption = Format((CDate(Date) - CDate(TextBox1)) / (TextBox3 * 365) * 100, "% 0.00") Yil = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""y"")") Ay = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""ym"")") Gun = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""md"")") Label57.Caption = Yil & " Yıl " & Ay & " Ay " & Gun & " Gün" Else Label56.Caption = Format((CDate(TextBox2) - CDate(TextBox1)) / (TextBox3 * 365) * 100, "% 0.00") Yil = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""y"")") Ay = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""ym"")") Gun = Evaluate("=DATEDIF(" & CLng(CDate(TextBox1)) & "," & CLng(CDate(Date)) & ",""md"")") Label57.Caption = Yil & " Yıl " & Ay & " Ay " & Gun & " Gün" End If End If End Sub
@Korhan Ayhan Hocam elinize emeğinize sağlık bu kısımda çalışıyor. Allah razı olsun.F8 hücresindei tarihi 08.08.2021 olarak düzeltirseniz aşağıdaki sonuç çıkacaktır.
3 Yıl 0 Ay 0 Gün
#22 nolu mesajımda ki kodu revize ettim. Tekrar deneyiniz.
Private Sub CommandButton1_Click()
If Label1.Caption = "" Then Label1.Caption = 0
If Label2.Caption = "" Then Label2.Caption = 0
If Label3.Caption = "" Then Label3.Caption = 0
Label4.Caption = Format(CDbl(Replace(Label1.Caption, "%", "")) + CDbl(Replace(Label2.Caption, "%", "")) + CDbl(Replace(Label3.Caption, "%", "")), "% 0.00")
End Sub
Size tavsiyem proje uygulamalarına girişmeden önce en azından basit IF-END IF sorgularını öğrenmeniz olacaktır. Yoksa çok bocalarsınız.
Bunlarla ilgili olarak hem forumda hem de nette bolca örnekler var. Araştırma yapıp bilgilerinizi genişletmeniz gerekiyor.
Bahsettiğiniz (LABEL) nesneler genellikle metinsel verileri depolamak amacıyla kullanılır. Bu sebeple matematiksel işlemlerde sıkıntı yaşamanız normaldir.
Ama tabi ki bu durum aşılamaz değildr.
Aşağıdaki gibi bir kurgu işinize yarayabilir. Kendi nesnelerinize uyarlarsınız.
C++:Private Sub CommandButton1_Click() If Label1.Caption = "" Then Label1.Caption = 0 If Label2.Caption = "" Then Label2.Caption = 0 If Label3.Caption = "" Then Label3.Caption = 0 Label4.Caption = Format(CDbl(Replace(Label1.Caption, "%", "")) + CDbl(Replace(Label2.Caption, "%", "")) + CDbl(Replace(Label3.Caption, "%", "")), "% 0.00") End Sub
Private Sub Topla_Click()
If Label56.Caption = "" Then Label56.Caption = 0
If Label60.Caption = "" Then Label60.Caption = 0
If Label62.Caption = "" Then Label62.Caption = 0
Label64.Caption = Format(CDbl(Replace(Label56.Caption, "%", "")) + CDbl(Replace(Label60.Caption, "%", "")) + CDbl(Replace(Label62.Caption, "%", "")), "% 0.00")
End Sub
Hocam yine deniyorum . Boş olunca Önceki mesajımdaki ekran görüntüsü hatasını veriyorHepsi boş bile olsa bile kod çalışacaktır.
Bence boş olma durumunu kontrol ediniz. Nesne boş ise hiçbir şey yazmaması gerekiyor.
Hocam Label 56 da hiç bir sey yazmıyor. Ben hala calistiramadimLabel56 nesnesini kontrol ediniz. (BOŞ DEĞİL)
Diğerlerini de kontrol edin. Onlarda boş değil.
Boş demek üzerinde hiçbir şey yazmıyor olmasıdır.