DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Slm,
Textboxta tarih girerken (gün.ay.yıl) gün ve ay yazıldıktan sonra noktalar otomatik yazılsın.
Örneğin;
17.12.2010 tarihini yazarken 17 yazdığımda nokta (.) otomatik yazılacak. Aynı şekilde ay yazarken de...
Private Sub TextBox1_Change()
With TextBox1
.SelLength = 1
If .SelText = "." Then
.SelStart = .SelStart + 1
.SelLength = 1
End If
End With
End Sub
Private Sub UserForm_Initialize()
With TextBox1
.MaxLength = 10
.EnterFieldBehavior = fmEnterFieldBehaviorRecallSelection
.Text = "##.##.####"
.SelStart = 0
.SelLength = 1
End With
End Sub
Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If UserForm1.TextBox1 <> "" Then
If Len(TextBox1) < 8 Then
MsgBox "Eksik Rakam Girdiniz!.", vbExclamation
Else
TextBox1 = Format(TextBox1, "0#"".""##"".""####")
End If
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Else
KeyAscii = 0
MsgBox "Sadece rakam girebilirsiniz.", vbExclamation
TextBox1.SelStart = Len(TextBox6)
End Select
TextBox1.MaxLength = 8
End Sub
Private Sub TextBox1_Change()
If UserForm1.TextBox1 <> "" Then
If Len(TextBox1) = 2 Then
TextBox1 = Format(TextBox1, "0#"".")
End If
If Len(TextBox1) = 5 Then
TextBox1 = Format(TextBox1, "0#"".""##"".")
End If
If Len(TextBox1) = 10 Then
TextBox1 = Format(TextBox1, "0#"".""##"".""####")
End If
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Else
KeyAscii = 0
MsgBox "Sadece rakam girebilirsiniz.", vbExclamation
TextBox1.SelStart = Len(TextBox6)
End Select
TextBox1.MaxLength = 10
Exit Sub
End Sub
If Len(TextBox1) = 4 Then
If Mid(TextBox1, 4, 1) > 1 Then
MsgBox "0 ile 1 arasında Bir Rakkam Giriniz.!!!"
TextBox1 = Trim(WorksheetFunction.Substitute(TextBox1, Right(TextBox1, 1), ""))
End If
End If
If UserForm1.TextBox1 <> "" Then
If Len(TextBox1) = 2 Then
TextBox1 = Format(TextBox1, "0#"".")
End If
If Len(TextBox1) = 5 Then
TextBox1 = Format(TextBox1, "0#"".""##"".20")
End If
If Len(TextBox1) = 10 Then
TextBox1 = Format(TextBox1, "0#"".""##"".""##")
End If
End If
End Sub
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Else
KeyAscii = 0
MsgBox "Sadece rakam girebilirsiniz.", vbExclamation
TextBox1.SelStart = Len(TextBox6)
End Select
TextBox1.MaxLength = 10
Exit Sub
End Sub
If TextBox1 <> "" Then
If Len(TextBox1) < 10 Then
MsgBox "Eksik Rakkam girdiniz.!!!", vbExclamation
End If
End If
Gün ve ay yazıldıktan sonra nokta "." işareti otomatik konulsun. Asıl amacım ilk mesajdan beri öyleydi. Buraya kadar geldik. Otomatik noktalama işareti de olursa kod son şeklini almış olacaktır.
---------------------------
UserForm üzerinde en az 30 tane tarih yazılan textbox var. Bu uzun kodu tek tek hepsine yazmaktansa tek bir kodla referans veremez miyiz. UserForm'da tarih yazılan textbox'lar haricinde de textbox'lar mevcut.
İlginiz için teşekkürler. Emeğinize sağlık..