• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Tarihlere Göre Kişi Getirme

Katılım
14 Haziran 2007
Mesajlar
142
Excel Vers. ve Dili
2007
Merhabalar,

Aşağıda
işe giriş tarihi
işten çıkış tarihi
ve
puantaj tarihine
göre kişileri listeleyeme çalıştığım kodlar bulunuyor.
Ancak
Çalışma yapacağım ay içerisinde çıkışı olan kişiyi getirmiyor.

işe giriş tarihi : 01.01.2005
işten çıkış tarihi : 20.01.2013
ve
puantaj tarihine : 31.01.2013

dediğimde bu kişi listelemiyor.

Yardımcı olabilirseniz çok sevinirim.



p = ComboBox1.ListIndex
dtControl = CDate(ComboBox1.Text)
fDate = dhFirstDayInMonth(dtControl)
lDate = dhLastDayInMonth(dtControl)


For Each ctl In UserForm5.Controls
cName = Trim(ctl.Name)

If Mid(cName, 1, 3) = "lbl" Then
ctl.Caption = ""

End If
Next

iSatir = 0

For i = 1 To 5
txt1 = Trim(Range("personelsicil!w" & i).Text)

If txt1 <> "" Then
If IsDate(txt1) Then
dtGiris = CDate(txt1)
If lDate >= dtGiris Then
txt1 = Trim(Range("personelsicil!AI" & i).Text)

If txt1 <> "" Then dtCikis = CDate(txt1)
'MsgBox "boş " + "1.gün" + CStr(fDate) + " " + "son gün" + CStr(lDate) + " " + "txt deg" + txt1 + "giris tar" + CStr(dtGiris) + "cıkıs tar" + CStr(dtCikis)

If txt1 = "" Then
'MsgBox "boş " + CStr(fDate) + " " + CStr(lDate)
iSatir = iSatir + 1
For Each ctl In UserForm5.Controls
cName = Trim(ctl.Name)
If cName = "lblAdSoyad" + CStr(iSatir) Then
ctl.Caption = Range("personelsicil!c" & i).Value
End If
Next
Else
'MsgBox "xxx " + CStr(fDate) + " " + CStr(lDate) + " " + txt1
If lDate <= dtCikis Then

MsgBox "yyy " + CStr(fDate) + " " + CStr(lDate)
iSatir = iSatir + 1
For Each ctl In UserForm5.Controls
cName = Trim(ctl.Name)
If cName = "lblAdSoyad" + CStr(iSatir) Then
ctl.Caption = Range("personelsicil!c" & i).Value
End If
Next

End If

End If
End If
End If
End If

Next i

---------------------

Function dhFirstDayInMonth(Optional dtmDate As Date = 0) As Date
' Return the first day in the specified month.
If dtmDate = 0 Then
' Did the caller pass in a date? If not, use
' the current date.
dtmDate = Date
End If
dhFirstDayInMonth = DateSerial(Year(dtmDate), _
Month(dtmDate), 1)
End Function

------------------

Function dhLastDayInMonth(Optional dtmDate As Date = 0) As Date
' Return the last day in the specified month.
If dtmDate = 0 Then
' Did the caller pass in a date? If not, use
' the current date.
dtmDate = Date
End If
dhLastDayInMonth = DateSerial(Year(dtmDate), _
Month(dtmDate) + 1, 0)
End Function
 
Konu günceldir. Bir yol gösterirseniz çok sevinirim.
 
Geri
Üst