Erdinç FIRTINA
Altın Üye
- Katılım
- 14 Şubat 2007
- Mesajlar
- 400
- Excel Vers. ve Dili
- excel 2003 türkçe
- Altın Üyelik Bitiş Tarihi
- 15-05-2026
Değerli Forum üyeleri,
Ekte bulunan dosyada;
TextBox1 de Adı Soyadı
TextBox2 de Doğum Tarihi
TextBox3 te Yaşı
TextBox4 de Yaş Aralığı
TextBox5 te Kayıt
TextBox7 de Bugünün tarihi var.
Bu textboxlardan 7’deki veri otomatik geliyor.
TextBox2’ye doğum tarihini giriyorum ve TextBox3 tede yaşını hesaplıyor.
Benim yapmak istediğim ise;
Textbox3 teki yaş 18 üstü olursa TextBox4’ te “ONSEKİZ YAŞ ÜSTÜ”,
Textbox3 teki yaş 18 ile 15 arasında olursa TextBox4’ te “15-18 ARASI”,
Textbox3 teki yaş 14 ile 7 arasında olursa TextBox4’ te “7-14 ARASI”,
Textbox3 teki yaş 6 ile 3 arasında olursa TextBox4’ te “3-6 ARASI”,
Textbox3 teki yaş 2 ile 0 arasında olursa TextBox4’ te “0-2 ARASI”,
Textbox3 teki yaş belirtilmemişse ise TextBox4’ te “YAŞ BELİRTİLMEMİŞ”,
Olarak yazsın. (kayıt sırasında)
Bunun için
If TextBox3.Value Then > “18” Then
TextBox4.Value = “18 YAŞ ÜSTÜ”
Olarak yazdım ancak birden fazla olasılık olduğunda yapamadım.
Yardımlarınız için şimdiden teşekkürler!!!
KODLAR
Private Sub CommandButton1_Click()
Sheets("ÖĞRENCİBİLGİLERİ").Select
Range("A1").Select
Range("A1") = "SIRA NO"
Range("B1") = "ADI SOYADI"
Range("C1") = "DOĞUM TARİHİ"
Range("D1") = "YAŞI"
Range("E1") = "YAŞ ARALIĞI"
Range("f1") = "KAYIT"
If TextBox1.Value = "" Then
MsgBox "VERİ GİRİNİZ"
Range("a1").Select
Unload Me
UserForm1.Show
Exit Sub
End If
If IsDate(TextBox2.Value) Then
TextBox2.Value = Format(TextBox2.Value, "dd.mm.yyyy")
If TextBox2 > TextBox7 Then
TextBox3 = DateDiff("yyyy", TextBox7, TextBox2)
Else
TextBox3 = DateDiff("yyyy", TextBox2, TextBox7)
End If
Else
MsgBox ("Lütfen Tarih Giriniz")
Exit Sub
End If
For sira = 1 To WorksheetFunction.CountA(Range("b1:b65536"))
Range("a" & sira + 1) = sira
Next
For Each bak In Range("b1:b" & WorksheetFunction.CountA(Range("b1:b65536")))
If bak = TextBox1 Then
MsgBox "Bu isimde bir kaydınız mevcut"
Range("a1").Select
Unload Me
UserForm1.Show
Exit Sub
End If
Next
say = WorksheetFunction.CountA(Range("b1:b65536")) + 1
If OptionButton1.Value = True Then Range("g" & say) = "BAŞLADI"
If OptionButton2.Value = True Then Range("g" & say) = "BAŞLAMADI"
If OptionButton1.Value = False And OptionButton2.Value = False Then
MsgBox "Lütfen BAŞLAYIP BAŞLAMADIĞINI BELİRTİNİZ"
Exit Sub
End If
Range("B" & say) = TextBox1.Value
Range("C" & say) = TextBox2.Value
Range("D" & say) = TextBox3.Value
Range("E" & say) = TextBox4.Value
Range("F" & say) = TextBox5.Value
Columns("A:I").EntireColumn.AutoFit
Columns("B:I").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("ÖĞRENCİBİLGİLERİ").Select
Range("a1").Select
ActiveWorkbook.Save
Unload Me
UserForm1.Show
'Exit Sub
'End If
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(TextBox2.Value) Then
TextBox2.Value = Format(TextBox2.Value, "dd.mm.yyyy")
Else
MsgBox ("Lütfen Tarih Giriniz")
Exit Sub
End If
End Sub
Private Sub UserForm_Initialize()
TextBox7 = Format(Date, "dd.mm.yyyy")
End Sub
DOSYA EKTEDİR
Ekte bulunan dosyada;
TextBox1 de Adı Soyadı
TextBox2 de Doğum Tarihi
TextBox3 te Yaşı
TextBox4 de Yaş Aralığı
TextBox5 te Kayıt
TextBox7 de Bugünün tarihi var.
Bu textboxlardan 7’deki veri otomatik geliyor.
TextBox2’ye doğum tarihini giriyorum ve TextBox3 tede yaşını hesaplıyor.
Benim yapmak istediğim ise;
Textbox3 teki yaş 18 üstü olursa TextBox4’ te “ONSEKİZ YAŞ ÜSTÜ”,
Textbox3 teki yaş 18 ile 15 arasında olursa TextBox4’ te “15-18 ARASI”,
Textbox3 teki yaş 14 ile 7 arasında olursa TextBox4’ te “7-14 ARASI”,
Textbox3 teki yaş 6 ile 3 arasında olursa TextBox4’ te “3-6 ARASI”,
Textbox3 teki yaş 2 ile 0 arasında olursa TextBox4’ te “0-2 ARASI”,
Textbox3 teki yaş belirtilmemişse ise TextBox4’ te “YAŞ BELİRTİLMEMİŞ”,
Olarak yazsın. (kayıt sırasında)
Bunun için
If TextBox3.Value Then > “18” Then
TextBox4.Value = “18 YAŞ ÜSTÜ”
Olarak yazdım ancak birden fazla olasılık olduğunda yapamadım.
Yardımlarınız için şimdiden teşekkürler!!!
KODLAR
Private Sub CommandButton1_Click()
Sheets("ÖĞRENCİBİLGİLERİ").Select
Range("A1").Select
Range("A1") = "SIRA NO"
Range("B1") = "ADI SOYADI"
Range("C1") = "DOĞUM TARİHİ"
Range("D1") = "YAŞI"
Range("E1") = "YAŞ ARALIĞI"
Range("f1") = "KAYIT"
If TextBox1.Value = "" Then
MsgBox "VERİ GİRİNİZ"
Range("a1").Select
Unload Me
UserForm1.Show
Exit Sub
End If
If IsDate(TextBox2.Value) Then
TextBox2.Value = Format(TextBox2.Value, "dd.mm.yyyy")
If TextBox2 > TextBox7 Then
TextBox3 = DateDiff("yyyy", TextBox7, TextBox2)
Else
TextBox3 = DateDiff("yyyy", TextBox2, TextBox7)
End If
Else
MsgBox ("Lütfen Tarih Giriniz")
Exit Sub
End If
For sira = 1 To WorksheetFunction.CountA(Range("b1:b65536"))
Range("a" & sira + 1) = sira
Next
For Each bak In Range("b1:b" & WorksheetFunction.CountA(Range("b1:b65536")))
If bak = TextBox1 Then
MsgBox "Bu isimde bir kaydınız mevcut"
Range("a1").Select
Unload Me
UserForm1.Show
Exit Sub
End If
Next
say = WorksheetFunction.CountA(Range("b1:b65536")) + 1
If OptionButton1.Value = True Then Range("g" & say) = "BAŞLADI"
If OptionButton2.Value = True Then Range("g" & say) = "BAŞLAMADI"
If OptionButton1.Value = False And OptionButton2.Value = False Then
MsgBox "Lütfen BAŞLAYIP BAŞLAMADIĞINI BELİRTİNİZ"
Exit Sub
End If
Range("B" & say) = TextBox1.Value
Range("C" & say) = TextBox2.Value
Range("D" & say) = TextBox3.Value
Range("E" & say) = TextBox4.Value
Range("F" & say) = TextBox5.Value
Columns("A:I").EntireColumn.AutoFit
Columns("B:I").Select
Selection.Sort Key1:=Range("B2"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
Sheets("ÖĞRENCİBİLGİLERİ").Select
Range("a1").Select
ActiveWorkbook.Save
Unload Me
UserForm1.Show
'Exit Sub
'End If
End Sub
Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(TextBox2.Value) Then
TextBox2.Value = Format(TextBox2.Value, "dd.mm.yyyy")
Else
MsgBox ("Lütfen Tarih Giriniz")
Exit Sub
End If
End Sub
Private Sub UserForm_Initialize()
TextBox7 = Format(Date, "dd.mm.yyyy")
End Sub
DOSYA EKTEDİR