this is the function i am doing here. but some how it is not picking up the friday's
could you please check. thanks i advance
Public Function LastDay(intOriginYear As Integer, intOriginMonth As Integer, ByVal strEffDate As Date, ByVal InputRateRead, ByVal RevalPriorToDate) As Variant
' **************************************************************************
' * Checks to see if the date from the file is the last day of the month. *
' * Prints if the day is NOT the last day of the month. *
' ***************************************************************************
Dim intCheck, intDayName, strDiff
Dim strDate, strCheckDate As Date
LastDay = Day(DateSerial(intOriginYear, intOriginMonth + 1, 0))
strDate = Day(strEffDate)
strCheckDate = intOriginMonth & "/" & LastDay & "/0" & intOriginYear
strDiff = DateDiff("d", strEffDate, strCheckDate, vbUseSystemDayOfWeek)
intDayName = Weekday(Format(strEffDate, "mmm dd, yyyy"))
strCurrentDay = Format(strEffDate, "dddd")
strNextDay = Format(strCheckDate - 1, "dddd")
strAfterNextday = Format(strCheckDate, "dddd")
strGeneralDate = Mid(strEffDate, 1, 5)
If strDate = LastDay Then
Else
If strDiff <= 3 And strNextDay = "Saturday" Or strNextDay = "Saturday" Then
'If strDiff <= 2 And strNextDay = "Saturday" Or strNextDay = "Saturday" Then
If intDayName = 1 Or intDayName = 7 Then 'Sun or Sat
Else
strNumEffDate = Format(strEffDate, "General Number")
strNow = Format(Now, "mm/dd/yy")
strNowMonth = Format(Now, "mm")
strNowConstantDay = "01"
strNowYear = Format(Now, "yyyy")
strNumber = strNowMonth & "/" & strNowConstantDay & "/" & strNowYear
strStaticRevalPriorToDate = Format(RevalPriorToDate, "General Number") '
If strCurrentDay = "Friday" And strNextDay = "Saturday" And strAfterNextday = "Sunday" Then
ElseIf strCurrentDay = "Friday" And strNextDay = "Friday" And strAfterNextday = "Saturday" Then
Else
If strNumEffDate < strStaticRevalPriorToDate Then
Print #2, InputRateRead
End If
End If
End If
Else
If intDayName = 1 Or intDayName = 7 Then 'Sun or Sat
Else
strNumEffDate = Format(strEffDate, "General Number")
strNow = Format(Now, "mm/dd/yy")
strNowMonth = Format(Now, "mm")
strNowConstantDay = "01"
strNowYear = Format(Now, "yyyy")
strFullDate = strNowMonth & "/" & strNowConstantDay & "/" & strNowYear
strStaticRevalPriorToDate = Format(RevalPriorToDate, "General Number") '
If strCurrentDay = "Friday" And strNextDay = "Saturday" And strAfterNextday = "Sunday" Then
'ElseIf strCurrentDay = "Friday" And strAfterNextday = "Saturday" Then
ElseIf strCurrentDay = "Friday" And strNextDay = "Friday" And strAfterNextday = "Saturday" Then
Else
If strNumEffDate < strStaticRevalPriorToDate Then
Print #2, InputRateRead
End If
End If
End If
End If
End If
End Function