TextBox-Hücre Tarih Formatı

r2d21

Altın Üye
Katılım
22 Kasım 2006
Mesajlar
18
Excel Vers. ve Dili
excel 2003
Altın Üyelik Bitiş Tarihi
09-02-2028
Merhaba,

Userformda örneğin;

TextBox'a 04.02.2015 formatı ile tarih yazıyorum. Bu excele ilgili hücreye giderken bu formatla gidiyor (excel hücreyi de o formata göre biçimlendirdim).

Bu kaydı o hücreden userforma tekrar çağırdığımda tarih formatı bu kez (Textbox'da) 2/4/2015 olarak geliyor.

Buradaki sıkıntı nedir.
Geri çağırırken tarih formatı neden değişiyor ve bunun önüne nasıl geçeriz?

Teşekkürler


Aşağıdaki makroyu kullanıyorum

Private Sub TextBox10_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Personel_V_1_0_0.TextBox10 <> "" Then
If Len(TextBox10) < 8 Then
MsgBox "Eksik Rakam Girdiniz!.", vbExclamation
Else
TextBox10 = Format(TextBox10, "0#"".""##"".""####")
End If
End If
End Sub

Private Sub TextBox10_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case Asc("0") To Asc("9")
Case Else
KeyAscii = 0
MsgBox "Sadece rakam girebilirsiniz.", vbExclamation
TextBox10.SelStart = Len(TextBox10)
End Select
TextBox10.MaxLength = 8
End Sub
 

EmrExcel16

Destek Ekibi
Destek Ekibi
Katılım
1 Kasım 2012
Mesajlar
1,524
Excel Vers. ve Dili
Office 365 Türkçe
Merhaba , hücreden çağırdınız kodlar hangisi.
 

r2d21

Altın Üye
Katılım
22 Kasım 2006
Mesajlar
18
Excel Vers. ve Dili
excel 2003
Altın Üyelik Bitiş Tarihi
09-02-2028
Selam ;

Private Sub Image14_Click() 'Kaydetme dügmesi
Dim sonsat As Integer
sonsat = Sheets("Data").[a65536].End(3).Row + 1
Call Main
Cells(sonsat, 1) = TextBox1
Cells(sonsat, 2) = ComboBox2.Value
Cells(sonsat, 3) = ComboBox3.Value
Cells(sonsat, 4) = TextBox4
Cells(sonsat, 5) = TextBox5
Cells(sonsat, 6) = TextBox6
Cells(sonsat, 7) = TextBox7
Cells(sonsat, 8) = TextBox8
Cells(sonsat, 9) = TextBox9
Cells(sonsat, 10) = TextBox10
Cells(sonsat, 11) = TextBox11
Cells(sonsat, 12) = TextBox12
Cells(sonsat, 13) = TextBox13
Cells(sonsat, 14) = TextBox14
Cells(sonsat, 15) = TextBox15.Value
Cells(sonsat, 16) = TextBox16
Cells(sonsat, 17) = ComboBox4.Value
Cells(sonsat, 18) = ComboBox5.Value
Cells(sonsat, 19) = ComboBox6.Value
Cells(sonsat, 20) = ComboBox7.Value
Cells(sonsat, 21) = TextBox21
Cells(sonsat, 22) = TextBox22
Cells(sonsat, 23) = TextBox23
Cells(sonsat, 24) = TextBox24
Cells(sonsat, 25) = TextBox25
Cells(sonsat, 26) = TextBox26
Cells(sonsat, 27) = TextBox27
Cells(sonsat, 28) = TextBox28
Cells(sonsat, 29) = TextBox29
Cells(sonsat, 30) = TextBox30
Cells(sonsat, 31) = TextBox31
Cells(sonsat, 32) = TextBox32
Cells(sonsat, 33) = TextBox33
Cells(sonsat, 34) = TextBox34
Cells(sonsat, 35) = TextBox35
Cells(sonsat, 36) = TextBox36
Cells(sonsat, 37) = TextBox37
Cells(sonsat, 38) = TextBox38
Cells(sonsat, 39) = TextBox39
Cells(sonsat, 40) = TextBox40
Cells(sonsat, 41) = TextBox41
Cells(sonsat, 42) = TextBox42
Cells(sonsat, 43) = TextBox43
Cells(sonsat, 44) = TextBox44
Cells(sonsat, 45) = TextBox45
Cells(sonsat, 46) = TextBox46
Cells(sonsat, 47) = TextBox47
Cells(sonsat, 48) = TextBox48
Cells(sonsat, 49) = TextBox49
Cells(sonsat, 50) = TextBox50
Cells(sonsat, 51) = TextBox51
Cells(sonsat, 52) = TextBox52
MsgBox "Kayit basarili"
ListBox1.List = Sheets("Data").Range("a2:l" & [a65536].End(3).Row).Value 'For refresh listbox
'TextBox61.Value = ListBox1.ListCount
TextBox61.Value = Range("bn1")
End Sub
Private Sub Image11_Click() 'degistir butonu
Dim sonsat As Integer
If ListBox1.ListIndex = -1 Then
MsgBox "Bir öge seçin", vbExclamation
Exit Sub
End If
sonsat = ListBox1.ListIndex + 2
Cells(sonsat, 1) = TextBox1.Text
Cells(sonsat, 2) = ComboBox2.Value
Cells(sonsat, 3) = ComboBox3.Value
Cells(sonsat, 4) = TextBox4.Text
Cells(sonsat, 5) = TextBox5.Text
Cells(sonsat, 6) = TextBox6.Text
Cells(sonsat, 7) = TextBox7.Text
Cells(sonsat, 8) = TextBox8.Text
Cells(sonsat, 9) = TextBox9.Text
Cells(sonsat, 10) = TextBox10.Text
Cells(sonsat, 11) = TextBox11.Text
Cells(sonsat, 12) = TextBox12.Text
Cells(sonsat, 13) = TextBox13.Text
Cells(sonsat, 14) = TextBox14.Text
Cells(sonsat, 15) = TextBox15.Value
Cells(sonsat, 16) = TextBox16
Cells(sonsat, 17) = ComboBox4.Value
Cells(sonsat, 18) = ComboBox5.Value
Cells(sonsat, 19) = ComboBox6.Value
Cells(sonsat, 20) = ComboBox7.Value
Cells(sonsat, 21) = TextBox21
Cells(sonsat, 22) = TextBox22
Cells(sonsat, 23) = TextBox23
Cells(sonsat, 24) = TextBox24
Cells(sonsat, 25) = TextBox25
Cells(sonsat, 26) = TextBox26
Cells(sonsat, 27) = TextBox27
Cells(sonsat, 28) = TextBox28
Cells(sonsat, 29) = TextBox29
Cells(sonsat, 30) = TextBox30
Cells(sonsat, 31) = TextBox31
Cells(sonsat, 32) = TextBox32
Cells(sonsat, 33) = TextBox33
Cells(sonsat, 34) = TextBox34
Cells(sonsat, 35) = TextBox35
Cells(sonsat, 36) = TextBox36
Cells(sonsat, 37) = TextBox37
Cells(sonsat, 38) = TextBox38
Cells(sonsat, 39) = TextBox39
Cells(sonsat, 40) = TextBox40
Cells(sonsat, 41) = TextBox41
Cells(sonsat, 42) = TextBox42
Cells(sonsat, 43) = TextBox43
Cells(sonsat, 44) = TextBox44
Cells(sonsat, 45) = TextBox45
Cells(sonsat, 46) = TextBox46
Cells(sonsat, 47) = TextBox47
Cells(sonsat, 48) = TextBox48
Cells(sonsat, 49) = TextBox49
Cells(sonsat, 50) = TextBox50
Cells(sonsat, 51) = TextBox51
Cells(sonsat, 52) = TextBox52
Call Main 'Progress Bar
MsgBox "Öge güncellendi"
ListBox1.List = Sheets("Data").Range("a2:l" & [a65536].End(3).Row).Value 'For refresh listbox
Image11.Visible = False
Image8.Visible = False

End Sub
Private Sub ListBox1_Click()
Sheets("data").Select
On Error Resume Next
Image11.Visible = True
Image8.Visible = True
Dim say, a As Integer
'For a = 0 To 45 'If listbox click ,fill the textboxes
'Controls("textbox" & a + 1) = ListBox1.Column(a)
TextBox1 = ListBox1.Column(0)
TextBox4 = ListBox1.Column(3)
TextBox5 = ListBox1.Column(4)
TextBox6 = ListBox1.Column(5)
TextBox7 = ListBox1.Column(6)
TextBox8 = ListBox1.Column(7)
TextBox9 = ListBox1.Column(8)
TextBox10 = ListBox1.Column(9)
TextBox11 = ListBox1.Column(10)
TextBox12 = ListBox1.Column(11)
TextBox13 = ListBox1.Column(12)
TextBox14 = ListBox1.Column(13)
TextBox15 = ListBox1.Column(14)
TextBox16 = ListBox1.Column(15)
TextBox21 = ListBox1.Column(20)
TextBox22 = ListBox1.Column(21)
TextBox23 = ListBox1.Column(22)
TextBox24 = ListBox1.Column(23)
TextBox25 = ListBox1.Column(24)
TextBox26 = ListBox1.Column(25)
TextBox27 = ListBox1.Column(26)
TextBox28 = ListBox1.Column(27)
TextBox29 = ListBox1.Column(28)
TextBox30 = ListBox1.Column(29)
TextBox31 = ListBox1.Column(30)
TextBox32 = ListBox1.Column(31)
TextBox33 = ListBox1.Column(32)
TextBox34 = ListBox1.Column(33)
TextBox35 = ListBox1.Column(34)
TextBox36 = ListBox1.Column(35)
TextBox37 = ListBox1.Column(36)
TextBox38 = ListBox1.Column(37)
TextBox39 = ListBox1.Column(38)
TextBox40 = ListBox1.Column(39)
TextBox41 = ListBox1.Column(40)
TextBox42 = ListBox1.Column(41)
TextBox43 = ListBox1.Column(42)
TextBox44 = ListBox1.Column(43)
TextBox45 = ListBox1.Column(44)
TextBox46 = ListBox1.Column(45)
TextBox47 = ListBox1.Column(46)
TextBox48 = ListBox1.Column(47)
TextBox49 = ListBox1.Column(48)
TextBox50 = ListBox1.Column(49)
TextBox51 = ListBox1.Column(50)
TextBox52 = ListBox1.Column(51)
TextBox53 = ListBox1.Column(52)
ComboBox2.Value = ListBox1.Column(1)
ComboBox3.Value = ListBox1.Column(2)
ComboBox4.Value = ListBox1.Column(16)
ComboBox5.Value = ListBox1.Column(17)
ComboBox6.Value = ListBox1.Column(18)
ComboBox7.Value = ListBox1.Column(19)
Label68.Caption = ListBox1.Column(70)
'Next
say = ListBox1.ListIndex + 2
Sheets("Data").Range("A" & say & ":bS" & say).Select
TextBox62 = ListBox1.ListIndex + 1
End Sub
Private Sub SpinButton1_SpinDown()
On Error Resume Next
If ListBox1.ListIndex = ListBox1.ListCount - 1 Then Exit Sub
With Me.ListBox1
.ListIndex = .ListIndex + 1
End With
End Sub
 

EmrExcel16

Destek Ekibi
Destek Ekibi
Katılım
1 Kasım 2012
Mesajlar
1,524
Excel Vers. ve Dili
Office 365 Türkçe
Tarihlerin hangi sütunda olduğunu söylememişsiniz ama , anladığım kadarıyla excelden bilgileri toplu bir şekilde alıyorsunuz , bilgileri aldıktan sonra Listbox da tarih hangi kolonda ise şu döngü ile istediğiniz formata çevirebilirsiniz.
ben ilk kolonda olarak varsaydım.
Kod:
For i = 0 To ListBox1.ListCount - 1
       ListBox1.List(i, 0) = Format(DateValue(ListBox1.List(i, 0)), "dd.mm.yyyy")
Next i
 

r2d21

Altın Üye
Katılım
22 Kasım 2006
Mesajlar
18
Excel Vers. ve Dili
excel 2003
Altın Üyelik Bitiş Tarihi
09-02-2028
Selam , çok teşekkür ederim , yanlış anlamışım kusura bakmayın. , tarih J2:J1000 arasıda , Listboxta tıkladığım kaydın bilgileri userformda textbox lara geliyor.
Daha sonra texboxtaki değeri değiştirip , ( örneğin textbox10 da 1.1.2020 yi 1.2.2020 yapıp ) kaydet e basarsam yeni kayıt olarak kaydediyor , değiştirie basarsam aynı kayıt da değiştiriyor.

Bir tane daha tarih var , o da K2:K1000 de , textbox11.

Tekrar Teşekkürler
 

EmrExcel16

Destek Ekibi
Destek Ekibi
Katılım
1 Kasım 2012
Mesajlar
1,524
Excel Vers. ve Dili
Office 365 Türkçe
Yazdığım yöntem ile listbox sütunlarında istediğiniz formata çevirebilirsiniz.
"ListBox1.List(i, 0)" buradaki 0 1. sütun demek , kendinize göre uyarlayınız.
 

r2d21

Altın Üye
Katılım
22 Kasım 2006
Mesajlar
18
Excel Vers. ve Dili
excel 2003
Altın Üyelik Bitiş Tarihi
09-02-2028
Teşekkür ederim , elinize sağlık , iyi günler dileğiyle
 

r2d21

Altın Üye
Katılım
22 Kasım 2006
Mesajlar
18
Excel Vers. ve Dili
excel 2003
Altın Üyelik Bitiş Tarihi
09-02-2028
Selam ;

Private Sub UserForm_Initialize() nin içine aşağıdaki kodu yazarak da çözdüm.
Bu şekilde de kullanmak isteyen olabilir , konu içinde alternatif çözüm olarak bulunsun istedim.
'.List(lindex, 3) = (Format((.List(lindex, 3)), "hh:mm AM/PM")) ' BO = times bu satır da saat olarak göstermek istenirse kullanılabilir.

Dim lindex&
ListBox1.List = Range("A2:bs2000").Value
ListBox1.ColumnCount = UBound(ListBox1.List, 2) + 1
With ListBox1
For lindex = 0 To .ListCount - 1
.List(lindex, 9) = (Format((.List(lindex, 9)), "dd.mm.yyyy")) ' J = dates
.List(lindex, 10) = (Format((.List(lindex, 10)), "dd.mm.yyyy")) ' K = dates
'.List(lindex, 3) = (Format((.List(lindex, 3)), "hh:mm AM/PM")) ' BO = times
Next
 

oceansss1475

Altın Üye
Katılım
25 Ocak 2020
Mesajlar
6
Excel Vers. ve Dili
2019
Altın Üyelik Bitiş Tarihi
11-10-2024
Merhaba arkadaşlar, çok acemiyim o yüzden sizin için küçük, benim için büyük bir hareket olacak. Yardım ederseniz mutlu olurum.
1. sorunum, excel çalışma sayfamdaki "F2:F60" aralığındaki hücreye TextBox ile tarih gönderiyorum, ancak; F sutunundaki tarihi değer alan kod yazılmış hücre bunu geldiği haliyle tarih olarak anlamıyor sanırım ve kodu çalıştırmıyor. Gelen tarihi manuel 1 rakamını dahi değiştirdiğimde kod çalışıyor. Sebep ve çözümünü anlatırmısınız lütfen.
2. sorunum, son satırı, aşağıdaki kod ile bulup değerleri yolluyorum.
Private Sub Kaydet_Click() *kodu netten kopyalayıp kullandım.
Set alan = Cells(1, 1).CurrentRegion
satırsayısı = alan.Rows.Count
sonsatır = satırsayısı + 1
Cells(sonsatır, 1).Select
ancak; gelen değerler farkettim ki son dolu hücre sonrasına değiş, kod yazılı olan hücre sonrasına geliyor. Yardım ve desteğiniz için şimdidedn teşekkürler.
 
Üst