Tarih ve telefon maskesi

Katılım
27 Mayıs 2021
Mesajlar
3
Excel Vers. ve Dili
Excel 2010 Türkçe
Altın Üyelik Bitiş Tarihi
27-05-2022
Ekteki örnekte textboxlarda kullanılabilecek tarih ve telefon maskesi var. Forumda bununla ilgili konu göremedim. Faydalı olabilir düşüncesiyle paylaştım.
İyi çalışmalar.
 

Ekli dosyalar

mustafa1205

Altın Üye
Katılım
23 Ekim 2010
Mesajlar
1,222
Excel Vers. ve Dili
Office 2016 / 64 Bit - Türkçe
Altın Üyelik Bitiş Tarihi
07-06-2024
Elinize Sağlık teşekkürler...
 
Katılım
24 Nisan 2005
Mesajlar
3,652
Excel Vers. ve Dili
Office 2016 EN 64 Bit
Altın Üyelik Bitiş Tarihi
25/05/2022
Güzel çalışma, module1 aşağıdaki şekilde de düzenlenebilir.

C#:
Public Function Format_Telefon(Kutu As MSForms.TextBox)
    Dim Nmr As String
    Dim list() As String
    
    Nmr = Kutu
        
    On Error Resume Next
    Nmr = Replace(Replace(Replace(Replace(Replace(Nmr, "(", ""), ")", ""), "_", ""), ".", ""), " ", "")
    list = Split(StrConv(Nmr, vbUnicode), Chr$(0))
    ReDim Preserve list(UBound(list) - 1)
    
    Nmr = "(___) ___ __ __"
    Nmr = "(" & list(0) & "__)" & " ___ __ __"
    Nmr = "(" & list(0) & list(1) & "_)" & " ___ __ __"
    Nmr = "(" & list(0) & list(1) & list(2) & ")" & " ___ __ __"
    Nmr = "(" & list(0) & list(1) & list(2) & ") " & list(3) & "__ __ __"
    Nmr = "(" & list(0) & list(1) & list(2) & ") " & list(3) & list(4) & "_ __ __"
    Nmr = "(" & list(0) & list(1) & list(2) & ") " & list(3) & list(4) & list(5) & " __ __"
    Nmr = "(" & list(0) & list(1) & list(2) & ") " & list(3) & list(4) & list(5) & " " & list(6) & "_ __"
    Nmr = "(" & list(0) & list(1) & list(2) & ") " & list(3) & list(4) & list(5) & " " & list(6) & list(7) & " __"
    Nmr = "(" & list(0) & list(1) & list(2) & ") " & list(3) & list(4) & list(5) & " " & list(6) & list(7) & " " & list(8) & "_"
    Nmr = "(" & list(0) & list(1) & list(2) & ") " & list(3) & list(4) & list(5) & " " & list(6) & list(7) & " " & list(8) & list(9)
    
    Kutu = Nmr
    For i = 1 To Len(Kutu)
      If IsNumeric(Mid(Kutu, i, 1)) = True Then
      Kutu.SelStart = i
      End If
    Next
    On Error GoTo 0
    
End Function

Public Function Format_Tarih(Kutu As MSForms.TextBox)
    Dim list() As String
    Dim Nmr As String
    
    Nmr = Kutu
        
    On Error Resume Next
    Nmr = Replace(Replace(Nmr, "-", ""), ".", "")
    list = Split(StrConv(Nmr, vbUnicode), Chr$(0))
    ReDim Preserve list(UBound(list) - 1)
    
    Nmr = "--.--.----"
    Nmr = list(0) & "-.--.----"
    Nmr = list(0) & list(1) & ".--.----"
    Nmr = list(0) & list(1) & "." & list(2) & "--.----"
    Nmr = list(0) & list(1) & "." & list(2) & list(3) & "-.----"
    Nmr = list(0) & list(1) & "." & list(2) & list(3) & list(4) & ".----"
    Nmr = list(0) & list(1) & "." & list(2) & list(3) & list(4) & "." & list(5) & "---"
    Nmr = list(0) & list(1) & "." & list(2) & list(3) & list(4) & "." & list(5) & list(6) & "--"
    Nmr = list(0) & list(1) & "." & list(2) & list(3) & list(4) & "." & list(5) & list(6) & list(7) & "-"
    Nmr = list(0) & list(1) & "." & list(2) & list(3) & list(4) & "." & list(5) & list(6) & list(7) & list(8)
        
    Kutu = Nmr
    For i = 1 To Len(Kutu)
      If IsNumeric(Mid(Kutu, i, 1)) = True Then
      Kutu.SelStart = i
      End If
    Next
    On Error GoTo 0
End Function
 

Korhan Ayhan

Administrator
Yönetici
Admin
Katılım
15 Mart 2005
Mesajlar
41,438
Excel Vers. ve Dili
Microsoft 365 Tr-En 64 Bit
Paylaşımınız için teşekkürler.

Yıllar önce @Haluk beyin benzer bir paylaşımı vardı. Hatırlatmak amacıyla linki paylaşıyorum.

 
Üst