günaydınarkadaşlar herkese iyi çalışmalr.
benim şöyle bir sorum olacka.
userfor açıldığında listox1 deki 1. sütündaki tarihler 01.01.2009 şeklinde geliyor.
ancak listele butonuna bastığımda tarih formatı şu şekle dönüşüyor 01/01/2009
bu sorunu nasıl düzeltebilirim?
benim şöyle bir sorum olacka.
userfor açıldığında listox1 deki 1. sütündaki tarihler 01.01.2009 şeklinde geliyor.
Kod:
Private Sub UserForm_Initialize()
' başlangıç tarigine min değeri getirecek
TextBox2.Text = Format(Application.Min(Range("a2:a" & Cells(65536, "a").End(3).Row)), "dd.mm.yyyy")
TextBox3.Text = Date
ListBox1.ColumnCount = 4
ListBox1.ColumnHeads = True
ListBox1.ColumnWidths = "50;50;60;50"
ListBox1.RowSource = "sayfa1!a2:d" & Cells(65536, "a").End(3).Row
ListBox1.ListIndex = ListBox1.ListCount - 1
'İLÇE
Sheets("sayfa1").Select
Set s1 = Sheets("sayfa1")
For x = 2 To s1.Cells(65536, "d").End(xlUp).Row
If WorksheetFunction.CountIf(s1.Range("b2:b" & x), s1.Cells(x, "b")) = 1 Then
ComboBox3.AddItem s1.Cells(x, "b").Value
End If
Next
If ComboBox3.ListCount > 0 Then
dizi = ComboBox3.List
ComboBox3.Clear
ComboBox3.List = sirala(dizi)
' ComboBox3.ListIndex = 0
End If
End Sub
ancak listele butonuna bastığımda tarih formatı şu şekle dönüşüyor 01/01/2009
Kod:
Private Sub CommandButton1_Click()
Dim baslangic_tar As Date, bitis_tar As Date, urun As String
Dim i As Long, k As Byte, a As Long
If Not IsDate(TextBox2.Value) Then
MsgBox "Başlangıç tarihi yanlış veya seçilmedi..", vbCritical, "UYARI"
TextBox2.SetFocus
Exit Sub
End If
If Not IsDate(TextBox3.Value) Then
MsgBox "Son tarih yanlış veya seçilmedi..!!", vbCritical, "UYARI"
TextBox3.SetFocus
Exit Sub
End If
TextBox1.Text = 0
ListBox1.RowSource = vbNullString
baslangic_tar = Format(CDate(TextBox2.Text), "dd.mm.yyyy")
bitis_tar = Format(CDate(TextBox3.Text), "dd.mm.yyyy")
ReDim myarr(1 To 8, 1 To 1)
For i = 2 To Cells(65536, "B").End(xlUp).Row
If ComboBox3.Value = "" Then
urun = Cells(i, "b").Value
Else
urun = ComboBox3.Value
End If
If ComboBox4.Value = "" Then
urun2 = Cells(i, "c").Value
Else
urun2 = ComboBox4.Value
End If
'If Cells(i, 5).Value >= baslangic_tar And Cells(i, 5).Value <= bitis_tar Then
If Cells(i, 1).Value >= baslangic_tar And Cells(i, 1).Value <= bitis_tar And urun = Cells(i, 2).Value And urun2 = Cells(i, 3).Value Then
say1 = Cells(i, 4)
say2 = Round(Cells(i, 7), 2)
say3 = Round(Cells(i, 8), 2)
TextBox1.Text = TextBox1.Text + say1
a = a + 1
ReDim Preserve myarr(1 To 8, 1 To a)
For k = 1 To 8
myarr(k, a) = Cells(i, k)
Next k
Else
End If
Next i
If a > 0 Then ListBox1.Column = myarr
Erase myarr
End Sub
Ekli dosyalar
-
116 KB Görüntüleme: 35