ªð¦^¦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!!

y = InputBox("¿é¤J¦~«×", , 2010)
MsgBox Format(Application.WorkDay(DateSerial(y - 1, 12, 31), 1), "yyyy/mm/dd")
MsgBox Format(Application.WorkDay(DateSerial(y + 1, 1, 1), -1), "yyyy/mm/dd")
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh
hsieh«e½ú§A¦n!
       °¸¹³«e½ú!ÁÂÁÂ!!³o«D¤p§Ì©Ò»Ý
       ·QÂP«Ü¤[¤£ª¾¦p¦ó?¸ÑÄÀ¤~¯àÅý§A©úÁA
       ²³æªº»¡´N¬OÅý¤@­ÓÀɮ׺ë·ÇµL»~ªº°õ¦æ
       µL¼Æªº¥ô°È,©Ò¥H¥²¶·­n¦³¥¿½Tªº®É¶¡
       µM¦Ó¤µ¦~ªº³Ì«á¤@­Ó¤u§@¤Ñ­è¦n¬O12¤ë31¤é
       ©Ò¥H¶}±ÒÀÉ®×
       Private Sub Workbook_Open()
         If Month(Date) = 12 And Day(Date) = 31 Then ¹Ú·Q
       End Sub
       Sub ¹Ú·Q()
          Sheet1.Select
          Range("AM1") = DateSerial(Year(Date) + 1, 1, 1)
       End Sub
       ¥ý¾Q³]µ{¦¡ªº­y¸ñ(½T»{¹q¸£ªº¤é´Á³]©wµL»~),¦A¥Ñ¤½¦¡
       AN3=IF($AM3>DAY(DATE(YEAR($AM$1),AN$1+1,)),"",
       IF(WEEKDAY(DATE(YEAR($AM$1),AN$1,$AM3),2)=7,"",
       DATE(YEAR($AM$1),AN$1,$AM3)))»s§@¦æ¨Æ¾ä
       µ¥«Ý¸ó¦~«áªº²Ä¤@­Ó¤u§@¤Ñ¶}±ÒÀÉ®×
       Private Sub Workbook_Open()
         If Month(Date) = 1 And Day(Date) = 3 Then ¦¨¯u
       End Sub
       Sub ¦¨¯u()
         If [AM1] < Date Then
         End If
       With Sheet1
         Set Rng = .Cells.Find(Date, lookat:=xlWhole)
         .Select
         If Not Rng Is Nothing Then Rng.Select Else MsgBox "§ä¤£¨ì¤µ¤Ñ"
         End With
         ActiveCell.Offset(, 1).Select
       End Sub
       µ{¦¡¥u­n¯à§ä¨ì¤µ¤Ñ,¨º¤@¤Á´N¹Ú·Q¦¨¯u,
       µ{¦¡¤@­Ó±µµÛ¤@­Ó¶],¥ô°È´N³v¤@ªº§¹¦¨
       ¬yµ{¤§¶¡²@µL´£¥Ü,¤]µL»Ý¿é¤J¤@®ð¨þ¦¨,
       ³o´N¬O¤p§Ìªº¹Ú·Q...
       ¦ý°ÝÃD¬O©ú¦~ªº²Ä¤@­Ó¤u§@¤Ñ¬O1¤ë3¤é
       «D1¤ë1¤é,¦Ó©ú¦~ªº³Ì«á­Ó¤u§@¤Ñ¬O12¤ë30¤é
       ¦Ó©¹«áªº¦~«×©O?ÅãµM¤p§Ìªº³o¨â­Óµ{¦¡³£¤£¾A¦X
       ©Ò¥H¤~µoªí¤å³¹¨D§U,½Ð¤£§[½ç±ÐÁÂÁ¦A¤T!!

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

¥»©«³Ì«á¥Ñ 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

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

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

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

¦^´_ 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

¦^´_ 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

        ÀR«ä¦Û¦b : Ä@­n¤j¡B§Ó­n°í¡B®ð­n¬X¡B¤ß­n²Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD