sayın üstadlarım textbox1'den textbox25'e kadar olan textboxların change özelliğini tarih formatına çevirmek istiyorum,
her textbox için ayrı ayrı yapıyorum çok yer kaplıyor, bunun kısa yolu yok mu
Kod:
Private Sub TextBox1_Change()
If Len(TextBox1) = 1 Then
If Mid(TextBox1, 1, 1) > 3 Then
MsgBox "0 ile 3 arasında Bir Rakkam Giriniz.!!!"
TextBox1 = ""
End If
End If
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#"".""##"".")
End If
If Len(TextBox1) = 10 Then
TextBox1 = Format(TextBox1, "0#"".""##"".""####")
End If
End If
End Sub
her textbox için ayrı ayrı yapıyorum çok yer kaplıyor, bunun kısa yolu yok mu
