ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¨C¦~ªº²Ä¤@­Ó¤u§@»P³Ì«á¤@­Ó¤u§@¤Ñ

¨C¦~ªº²Ä¤@­Ó¤u§@»P³Ì«á¤@­Ó¤u§@¤Ñ

¦U¦ì«e½ú§A­Ì¦n!
¡@¡@      «e½ú!
              ³o¬O¨C¦~ªº³Ì«á¤@¤Ñ
             If Month(Date) = 12 And Day(Date) = 31 Then ¹Ú·Q
             ½Ð°Ý¨C¦~³Ì«á¤@­Ó¤u§@¤Ñµ{¦¡¦p¦ó?
             ³o¬O¨C¦~ªº²Ä¤@¤Ñ
             If Month(Date) = 1 And Day(Date) = 1 Then ¦¨¯u
             ½Ð°Ý¨C¦~ªº²Ä¤@­Ó¤u§@¤@¤Ñµ{¦¡¦p¦ó?
             ½Ðª¾¹Dªº«e½ú,¤£§[½ç±ÐÁÂÁ¦A¤T!!

¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-8-23 19:40 ½s¿è

¦^´_ 9# GBKEE
2007¤]¥i¨Ï¥ÎEvaluate

    firstworkday = CDate(Evaluate("WORKDAY(DATE(YEAR(TODAY()),1,0),1)"))
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

[ª©¥DºÞ²z¯d¨¥]
  • Hsieh(2010-8-23 22:19): Åwªï¶Q«È¥úÁ{

¦U¦ì§A¦n, ªì¨ì¶Q¹Ò

³Ì«á¤@­Ó¤u§@¤Ñ
  1. Function LastFridayInMonth(lngYear As Long, lngMonth As Long) As Date
  2.     Dim lngLastDay As Long
  3.     'define last day of the month of interest:
  4.     lngLastDay = DateSerial(lngYear, lngMonth + 1, 0)
  5.     'use to get last friday:
  6.     LastFridayInMonth = lngLastDay - WeekDay(lngLastDay, vbFriday) + 1
  7. End Function

  8. Sub Check_Last_WorkDay()

  9. MsgBox LastFridayInMonth(2011, 12)

  10. End Sub
½Æ»s¥N½X

TOP

¦^´_ 9# GBKEE
hsieh«e½ú§A¦n!
       °¸¹³«e½ú!ÁÂÁÂ!!ÁÂÁ¦A¤T!!

GBKEE«e½ú§A¦n!
¡@¡@¡@¨}®v!ÁÂÁÂ!¤p§Ì¥H¬°¦s¦¨2007®æ¦¡´N¥i¥H
      °õ¦æÁÙ¬O¤£¦æ«¢«¢!!ÁÂÁ¦A¤T!!

TOP

¦^´_ 7# myleoyes
¦^´_  myleoyes
2003µLªk¨Ï¥Î  Application.WorkDay(DateSerial(Year(Date) - 1, 12, 31), 1) µ{¦¡½X
GBKEE µoªí©ó 2010-8-21 15:38

§Úªºª©¥» ¬O 2003      §Ú¤£ª¾¹D 2007 µLªk¨Ï¥Î Evaluate

TOP

first_last.rar (7.98 KB) ª©¥»­Y¤£¤ä´©,¦Û¤v¼g¨ç¼Æ,366¤Ñªá¤£¤F¤Ó¦h®É¶¡
  1. Function MyWorkday(y%, t%)
  2. Dim Ar()
  3. For i = DateSerial(y, 1, 1) To DateSerial(y, 12, 31)
  4.    If Weekday(i, 2) < 6 Then
  5.    ReDim Preserve Ar(s)
  6.    Ar(s) = i
  7.    s = s + 1
  8.    End If
  9. Next
  10. If t = 0 Then
  11.    MyWorkday = Ar(0) '²Ä¤@­Ó¤u§@¤Ñ
  12.    ElseIf t = 1 Then
  13.    MyWorkday = Ar(s - 1) '³Ì«á¤u§@¤Ñ
  14. End If
  15. End Function
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 5# GBKEE
GBKEE«e½ú§A¦n!
¡@¡@¡@¨}®v!ÁÂÁÂ!µ{¦¡¦³»~³á!
      «¬ºA¤£²Å¦X,¦pªþÀÉLeo27-2
      ¥¿½TÀ³¸Ó¦pªþÀÉLeo27-1
      ¥ý±N¤é´Á½Õ¾ã¦Ü2010/12/31
      ¶}±ÒÀÉ®×µ{¦¡¦bAM1«Ø¥ß¤é´Á¦sÀÉÃö³¬
      ¦A¤é´Á½Õ¾ã¦Ü2011/1/3
      ¶}±ÒÀÉ®×µ{¦¡Åã¥Ü¹Ú·Q¦¨¯u´N¹ïÅo!!
      ½Ð°Ñ¦Ò¬Ý¬ÝÁÂÁ¦A¤T!!

Leov27-1.rar (12.58 KB)

Leov27-2.rar (11.52 KB)

TOP

¦^´_ 5# GBKEE
hsieh«e½ú§A¦n!
       °¸¹³«e½ú!ÁÂÁÂ!!«zÆg­C!!ÁÂÁ¦A¤T!!

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2010-8-21 15:40 ½s¿è

¦^´_ 3# myleoyes
2003µLªk¨Ï¥Î  Application.WorkDay(DateSerial(Year(Date) - 1, 12, 31), 1) µ{¦¡½X
  1. Private Sub Workbook_Open()
  2.    If Evaluate("WORKDAY(""" & Year(Date) & "/1 "",1)") = Date Then ¦¨¯u
  3.   If Evaluate("WORKDAY(""" & Year(Date) + 1 & "/1"",-1)") = Date Then ¹Ú·Q
  4. End Sub
½Æ»s¥N½X

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-8-21 21:38 ½s¿è
  1. Private Sub Workbook_Open()
  2. y = CDate(Application.WorkDay(DateSerial(Year(Date) - 1, 12, 31), 1)) '¤µ¦~ªº²Ä¤@­Ó¤u§@¤Ñ
  3. y1 = CDate(Application.WorkDay(DateSerial(Year(Date) + 1, 1, 1), -1)) '¤µ¦~ªº³Ì«á¤@­Ó¤u§@¤Ñ
  4. If Date = y1 Then '¦pªG¤µ¤Ñ¬O¤µ¦~ªº³Ì«á¤@­Ó¤u§@¤Ñ
  5. MsgBox "Today is lastworkday for this year"
  6. ElseIf Date = y Then '¦pªG¤µ¤Ñ¬O¤µ¦~ªº²Ä¤@­Ó¤u§@¤Ñ
  7. MsgBox "Today is firstworkday for this year"
  8. End If
  9. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ·R¤£¬O­n¨D¹ï¤è¡A¦Ó¬O­n¥Ñ¦Û¨­ªº¥I¥X¡C
ªð¦^¦Cªí ¤W¤@¥DÃD