TextBox'ta Iban numarası yazma

veysikulte1

Altın Üye
Katılım
23 Ekim 2015
Mesajlar
99
Excel Vers. ve Dili
2016
Altın Üyelik Bitiş Tarihi
19-04-2027
arkadaşlar TextBox1 e geldiğimde otomatik TR yazılsın istiyorum ve ibanı yazarken aralarda boşluk istiyorum örneğin TR81 0000 0000 0000 000000 0000
şeklide kediliğinden yazılsın bide boşlukları ve TR yi saymasak 24 karakterden fazla yazılmasın eksikte yazılmasın. bide TextBox2 ye geldiğimde otomatik takvim açılsın bunun için yardımcı olabilirmisiniz şimdiden çok teşekkür ederim.
 
Katılım
13 Temmuz 2016
Mesajlar
613
Excel Vers. ve Dili
Excel 2010 & 2016 Türkçe
Altın Üyelik Bitiş Tarihi
06-03-2020
1. sorunun cevabı
Kod:
  Private Sub TextBox1_Change()
        With TextBox1
            .SelLength = 1
            If .SelText = " " Then
                .SelStart = .SelStart + 1
                .SelLength = 1
            End If
        End With
    End Sub
    '
    Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        On Error GoTo ErrHand:
        With TextBox1
            If KeyCode = vbKeyLeft Or KeyCode = vbKeyBack Then
                KeyCode = vbKeySelect
                .SelStart = .SelStart - 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyRight Then
                KeyCode = vbKeySelect
                .SelStart = .SelStart + 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyDelete Then
                KeyCode = vbKeySelect
                    If .SelText = " " Then
                       .SelText = " "
                    Else
                        .SelText = "#"
                    End If
                .SelStart = .SelStart - 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyHome Then
                KeyCode = vbKeySelect
                .SelStart = 0
                .SelLength = 1
            ElseIf KeyCode = vbKeyEnd Then
                KeyCode = vbKeySelect
                .SelStart = Len(TextBox1) - 1
                .SelLength = 1
            End If
        End With
            Exit Sub
ErrHand:
        KeyCode = vbKeySelect
        TextBox1.SelStart = 0
        TextBox1.SelLength = 1
    End Sub
    '
    Private Sub UserForm_Initialize()
        With TextBox1
            .MaxLength = 30
            .EnterFieldBehavior = fmEnterFieldBehaviorRecallSelection
            .Text = "#### #### #### #### ##### ####"
            
            .SelStart = 0
            .SelLength = 1
 'veya
 
   '.Text = "TR## #### #### #### ##### ####"
            
           ' .SelStart = 2
            '.SelLength = 1

        End With
    End Sub
 
Son düzenleme:

veysikulte1

Altın Üye
Katılım
23 Ekim 2015
Mesajlar
99
Excel Vers. ve Dili
2016
Altın Üyelik Bitiş Tarihi
19-04-2027
ekteki dosyayı incelermisiniz söylediğiniz kodu ekledim dondu excell. eklenmemiş halini koydum bakarsanız sevinirim.
 

Ekli dosyalar

Katılım
13 Temmuz 2016
Mesajlar
613
Excel Vers. ve Dili
Excel 2010 & 2016 Türkçe
Altın Üyelik Bitiş Tarihi
06-03-2020
Userform içindeki kodları silip aşağıdaki kodları yapıştırın
Kod:
Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
    Case Asc("0") To Asc("9")
    Case Else
    KeyAscii = 0
    MsgBox "Sadece rakam girebilirsiniz.", vbExclamation
    TextBox2.SelStart = Len(TextBox2)
    End Select
    TextBox1.MaxLength = 8
End Sub


Private Sub CommandButton1_Click()
Range("A3").Select
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
If Range("A3").Value = "" Then
Range("A3").Value = 1
Range("A3").Select
Else
ActiveCell.Value = ActiveCell.Offset(-1, 0) + 1
End If
ActiveCell.Offset(0, 1).Value = TextBox1.Text
ActiveCell.Offset(0, 2).Value = TextBox2.Text
ActiveCell.Offset(0, 3).Value = ComboBox1.Text
ActiveCell.Offset(0, 4).Value = TextBox4.Text
ActiveCell.Offset(0, 6).Value = TextBox5.Text
ActiveCell.Offset(0, 7).Value = ComboBox2.Text
ActiveCell.Offset(0, 8).Value = TextBox7.Text

MsgBox ("Kayıt Tamamlandı")
TextBox1.Text = ""
TextBox2.Text = ""

End Sub




Private Sub TextBox4_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
UserForm2.Show
End Sub


















Private Sub TextBox5_Change()
        With TextBox5
            .SelLength = 1
            If .SelText = " " Then
                .SelStart = .SelStart + 1
                .SelLength = 1
                
            End If
        End With
    End Sub
    '
    Private Sub TextBox5_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        On Error GoTo ErrHand:
        With TextBox5
            If KeyCode = vbKeyLeft Or KeyCode = vbKeyBack Then
                KeyCode = vbKeySelect
                .SelStart = .SelStart - 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyRight Then
                KeyCode = vbKeySelect
                .SelStart = .SelStart + 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyDelete Then
                KeyCode = vbKeySelect
                    If .SelText = " " Then
                       .SelText = " "
                    Else
                        .SelText = "_"
                    End If
                .SelStart = .SelStart - 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyHome Then
                KeyCode = vbKeySelect
                .SelStart = 0
                .SelLength = 1
            ElseIf KeyCode = vbKeyEnd Then
                KeyCode = vbKeySelect
                .SelStart = Len(TextBox5) - 1
                .SelLength = 1
            End If
        End With
            Exit Sub
ErrHand:
        KeyCode = vbKeySelect
        TextBox5.SelStart = 0
        TextBox5.SelLength = 1
    End Sub
    '
    Private Sub UserForm_Initialize()
    TextBox2.MaxLength = 11
        With TextBox5
            .MaxLength = 31
            .EnterFieldBehavior = fmEnterFieldBehaviorRecallSelection
         .Text = "TR__ ____ ____ ____ ______ ____"
            
            .SelStart = 2
            .SelLength = 1

        End With
        With TextBox7
            .MaxLength = 16
            .EnterFieldBehavior = fmEnterFieldBehaviorRecallSelection
         .Text = "0(___)___ ____"
            
            .SelStart = 2
            .SelLength = 1

        End With
    End Sub



Private Sub TextBox7_Change()
        With TextBox7
            .SelLength = 1
            If .SelText = " " Or .SelText = "(" Or .SelText = ")" Then
                .SelStart = .SelStart + 1
                .SelLength = 1
                
            End If
        End With
    End Sub
    '
    Private Sub TextBox7_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
        On Error GoTo ErrHand:
        With TextBox7
            If KeyCode = vbKeyLeft Or KeyCode = vbKeyBack Then
                KeyCode = vbKeySelect
                .SelStart = .SelStart - 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyRight Then
                KeyCode = vbKeySelect
                .SelStart = .SelStart + 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyDelete Then
                KeyCode = vbKeySelect
                    If .SelText = " " Then
                       .SelText = " "
                    Else
                        .SelText = "_"
                    End If
                .SelStart = .SelStart - 1
                .SelLength = 1
            ElseIf KeyCode = vbKeyHome Then
                KeyCode = vbKeySelect
                .SelStart = 0
                .SelLength = 1
            ElseIf KeyCode = vbKeyEnd Then
                KeyCode = vbKeySelect
                .SelStart = Len(TextBox7) - 1
                .SelLength = 1
            End If
        End With
            Exit Sub
ErrHand:
        KeyCode = vbKeySelect
        TextBox7.SelStart = 1
        TextBox7.SelLength = 1
    End Sub
 

veysikulte1

Altın Üye
Katılım
23 Ekim 2015
Mesajlar
99
Excel Vers. ve Dili
2016
Altın Üyelik Bitiş Tarihi
19-04-2027
kodları ekliyorum donuyor bide bulma yeride hata veriyor
 
Katılım
13 Temmuz 2016
Mesajlar
613
Excel Vers. ve Dili
Excel 2010 & 2016 Türkçe
Altın Üyelik Bitiş Tarihi
06-03-2020
Buyurun Sorunsuz Çalışıyor :hihoho::hihoho:
 

Ekli dosyalar

veysikulte1

Altın Üye
Katılım
23 Ekim 2015
Mesajlar
99
Excel Vers. ve Dili
2016
Altın Üyelik Bitiş Tarihi
19-04-2027
teşekkürler güzel olmuş kayıt tamamlandı dedikten sonra program yeni açılmış gibi diğer bilgiler silinecek şekilde yapabilirmiyiz ?
 
Katılım
13 Temmuz 2016
Mesajlar
613
Excel Vers. ve Dili
Excel 2010 & 2016 Türkçe
Altın Üyelik Bitiş Tarihi
06-03-2020
Rica ederim. aşağıdaki kodları MsgBox ("Kayıt Tamamlandı") altına yapıştırınız.
Kod:
[COLOR="DarkRed"]MsgBox ("Kayıt Tamamlandı")[/COLOR]
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
UserForm_Initialize
İyi çalışmalar
 

veysikulte1

Altın Üye
Katılım
23 Ekim 2015
Mesajlar
99
Excel Vers. ve Dili
2016
Altın Üyelik Bitiş Tarihi
19-04-2027
çok teşekkür ederim.
 
Üst