Lİstbox Tarİh Formati

Katılım
11 Ağustos 2005
Mesajlar
239
ARKADAŞLAR AŞAĞIDAKİ KODDA TEXTBOX 5 TEN LİSTBOX1 E GEÇERKEN TARİH SORUNU VAR NE YAPMALIYIM 24/11/2007 YAZIYORUM 25/01/1906 VEYA 39568 GİBİ RAKAM ÇIKIYOR

rivate Sub CommandButton1_Click()
Dim S1 As Worksheet
Set S1 = Sheets("Sayfa1")
For a = 1 To 5
If Controls("textbox" & a) = "" Then
MsgBox "VERİ GİRİŞİ EKSİKTİR"
Exit Sub
End If
Next
S1.Select
sonsat = S1.[a65536].End(3).Row + 1
S1.Cells(sonsat, 1) = sonsat - 1
S1.Cells(sonsat, 2) = TextBox1
S1.Cells(sonsat, 3) = TextBox2
S1.Cells(sonsat, 4) = TextBox3
S1.Cells(sonsat, 5) = TextBox4
S1.Cells(sonsat, 6) = CLng(CDate(TextBox5))
UserForm_Initialize
ListBox1.ListIndex = sonsat - 2
End Sub
Private Sub CommandButton2_Click()
Dim S1 As Worksheet
Set S1 = Sheets("Sayfa1")
sor = MsgBox("Değiştirmek istediğinizden eminmisiniz?", vbYesNo)
S1.Select
If sor = vbNo Then Exit Sub
sonsat = ListBox1.ListIndex + 2
S1.Cells(sonsat, 2) = TextBox1
S1.Cells(sonsat, 3) = TextBox2
S1.Cells(sonsat, 4) = TextBox3
S1.Cells(sonsat, 5) = TextBox4
S1.Cells(sonsat, 6) = CLng(CDate(TextBox5))
ListBox1.RowSource = "B2:F" & [a65536].End(3).Row
MsgBox "DEĞİŞİKLİK YAPILMIŞTIR"
End Sub
Private Sub CommandButton3_Click()
Dim S1 As Worksheet
Set S1 = Sheets("Sayfa1")
sor = MsgBox("Silmek istediğinizden eminmisiniz?", vbYesNo)
If sor = vbNo Then Exit Sub
sat = ListBox1.ListIndex + 2
S1.Select
S1.Range("B" & sat & ":F" & sat).Delete
[a65536].End(3).ClearContents
Range("a2:G" & [a65536].End(3).Row).Interior.ColorIndex = xlNone
UserForm_Initialize
CommandButton5_Click
MsgBox "SEÇİLEN VERİ SİLİNMİŞTİR"
End Sub
Private Sub CommandButton5_Click()
CommandButton1.Enabled = True
CommandButton2.Enabled = False
CommandButton3.Enabled = False
For a = 1 To 5
Controls("textbox" & a) = ""
Next
ListBox1.ListIndex = -1
End Sub

Private Sub CommandButton6_Click()
UserForm1.Show
End Sub


Private Sub CommandButton7_Click()
Unload Me
End Sub

Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Dim S1 As Worksheet
Set S1 = Sheets("Sayfa1")
For a = 0 To 3
Controls("textbox" & a + 1) = ListBox1.Column(a)
Next
TextBox5 = Format(ListBox1.Column(3), "dd.mm.yyyy")
sat = ListBox1.ListIndex + 2
S1.Select
S1.Range("A" & sat & ":F" & sat).Interior.ColorIndex = 6
CommandButton1.Enabled = False
CommandButton2.Enabled = True
CommandButton3.Enabled = True
End Sub

Private Sub StatusBar1_PanelClick(ByVal Panel As MSComctlLib.Panel)

End Sub

Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean)
TextBox5 = Format(TextBox5, "dd.mm.yyyy")
End Sub
Private Sub UserForm_Initialize()
Dim S1 As Worksheet
Set S1 = Sheets("Sayfa1")
S1.Select
ListBox1.ColumnCount = 5
ListBox1.ColumnWidths = "130;40;90;80;60"
ListBox1.RowSource = "B2:F" & [a65536].End(3).Row
CommandButton2.Enabled = False
CommandButton3.Enabled = False
Me.Top = 40
Me.Left = 80
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Dim S1 As Worksheet
Set S1 = Sheets("Sayfa1")
S1.Select
S1.Range("a2:G65536").Interior.ColorIndex = xlNone
End Sub
 
Katılım
15 Haziran 2006
Mesajlar
3,704
Excel Vers. ve Dili
Excel 2003, 2007, 2010 (TR)
Merhabalar,

Kodlarınızdaki, aşağıdaki gibi CLng içeren satırları

Kod:
[COLOR=blue]S1.Cells(sonsat, 6) =[/COLOR] [COLOR=red][B]CLng([/B][/COLOR][COLOR=blue]CDate(TextBox5)[/COLOR][COLOR=red][B])[/B][/COLOR]
şu şekilde değiştirip deneyin.

Kod:
If IsDate(TextBox5) Then : [COLOR=blue]S1.Cells(sonsat, 6)[/COLOR] [COLOR=blue]= CDate(TextBox5)[/[/COLOR]CODE]
 
Katılım
15 Haziran 2006
Mesajlar
3,704
Excel Vers. ve Dili
Excel 2003, 2007, 2010 (TR)
O zaman dosyanızı foruma eklemelisiniz. Benim kodlardan kabataslak görebildiğim, muhtemel sebep buydu...
 
Katılım
11 Ağustos 2005
Mesajlar
239
arkadaşlar aslında userform 2 ve 3 aynı ama userform3 te listboxta tarih formatında problem var listboxta 39617 gözüküyor ama textbox a alınca düzeliyor
 
Üst