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

DatePart ªº§PÂ_¦¡

DatePart ªº§PÂ_¦¡

A1 ¤º®e¬° 2010/25/25
§Ú¥H¤U¦C³¯­z¦¡¨Ó§PÂ_A1ªº¤ë¥÷¬O§_¬°¥¿½T®æ¦¡
    If IsError(DatePart("m", Range("A1"))) = False Then
    MsgBox ("µ{¦¡§Y±N¤¤Â_.")
    End If
µ²ªGµ{¦¡µLªk°õ¦æ, §Ú¥H¤U¦C³¯­z¦¡¨ÓÅçÃÒ Datepart("m", Range("A1")) ¬O§_¯à°õ¦æ,
MsgBox DatePart("m", Range("A2"))
µ²ªG±o¨ì Type mismatch ªº¿ù»~°T®§.
¤S·í§Ú§âA1ªº¤º®e§R°£®É(§e²{ªÅ¥ÕÄæ¦ì),§Ú¦A¥H¤U¦C³¯­z¦¡ÅçÃÒ¬O§_¯à¨ú±o¼Æ­È,
MsgBox DatePart("m", Range("A2"))
µ²ªG¶Ç¦^ 12
·Ó²z»¡,ªÅ¥ÕªºÄæ¦ì¤£¬O¨S¦³¸ê®Æ¶Ü,¬°¦ó·|¨ú±o12ªº¼Æ­È?
¬O§_¦³¤èªk¯à¦bºI¨úA1¤ºªº¤ë¥÷¼Æ¦r«á,·í®æ¦¡¤£¹ï®É©Î¬OA1Äæ¦ìªÅ¥Õ®É,¯à±a¥X¤å¦r¤è¶ô(MsgBox)?
¥¿½T¨Ó»¡,¥ÑA1©Ò±o¨ìªºµ²ªG¥u¦³13­Ó, ±q1~12 ¥H¤Î¤@­Ó·í®æ¦¡¿ù»~©ÎÄæ¦ìªÅ¥Õ®É©Ò¯à±a¥X¤å¦r¤è¶ôªº­È.

  1. Sub nn()
  2. If IsDate([A1].Value) Then
  3. MsgBox Month([A1])
  4. Else
  5. MsgBox "Err"
  6. End If
  7. End Sub
½Æ»s¥N½X
¤£¹L¦pªG¿é¤J¼Æ­È1~2958465
1900 ¦~ 1 ¤ë 1 ¤é(¼Æ­È¬°1)¡]¦pªG¨Ï¥Î 1904 ¦~¤é´Á¨t²Î¡A«h¬° 1904 ¦~ 1 ¤ë 1 ¤é¡^
9999 ¦~ 12 ¤ë 31 ¤é(¼Æ­È¬°2958465)
¦b¦¹¤§¶¡ªº¼Æ­È¤]·|³Q»{¬°¬O¤é´Á
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

ÁÂÁÂ...
³o¤UÅܦ¨¤é´Á¨t²Îªº°ÝÃD¤F.=   =||||

TOP

        ÀR«ä¦Û¦b : ¤H­n¦Û·R¡A¤~¯à·R´¶¤Ñ¤Uªº¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD