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

Excel³]©w¼u¸õµøµ¡-?(¤w¸Ñ¨M)

Excel³]©w¼u¸õµøµ¡-?(¤w¸Ñ¨M)

¥»©«³Ì«á¥Ñ fmsc168 ©ó 2011-9-25 23:59 ½s¿è

·Q½Ð°Ý¤@¤U!
¦pªG§Ú­n³]©w£¸«ö¨ì¬Y¤À­¶(¤ñ¦p·~ÁZ)«K·|¥X²{¤pµøµ¡­n§Ú¿é¤J¤é´Á½T©w«áP3´Nµ¥©ó­è­è¿é¤J¤§¤é´Á~
¨º­n«ç»ò°µªü?

¥H¤W¦A³Â·Ð¤j®a¤F~

·PÁÂ!

°ÝÃD1

¹ï¡u·~ÁZ¡v¤u§@ªí¼ÐÅÒ¡A«ö·Æ¹«¥kÁä¿ï¡uÀ˵øµ{¦¡½X¡v

¶K¤W¤U¦Cµ{¦¡½X...
  1. Private Sub Worksheet_Activate()

  2.     [p3].Value = InputBox("½Ð¿é¤J¤é´Á")

  3. End Sub
½Æ»s¥N½X
diabo

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2011-9-24 22:07 ½s¿è
·Q½Ð°Ý¤@¤U!
¦pªG§Ú­n³]©w¤@«ö¨ì¬Y¤À­¶(¤ñ¦p·~ÁZ)«K·|¥X²{¤pµøµ¡­n§Ú¿é¤J¤é´Á½T©w«áP3´Nµ¥©ó­è­è¿é¤J¤§¤é´Á ...
fmsc168 µoªí©ó 2011-9-24 14:44

§Ú·Q²Ä¤@­Ó°ÝÃD¸Ñ¨MªºÃöÁäÀ³¸Ó¬O¦b :
­n¦p¦ó¦b¤Á´«­¶Ã±(§Y§A©Ò»¡ªº¤À­¶)®ÉIJµo¶}±Ò¿é¤J¤é´Áªº¤pµøµ¡,
¨Ã¥B¯à¥¿½Tªº±N¤é´Á¤å¦r©ñ¨ì¸Ó­¶Ã±«ü©wªºÀx¦s®æ¤W.

¦b«ä¦Ò¸Ñ¨M¤è®×®É¥i¥ý½T»{Åܰʶµ¥Ø(»Ý­n©ó¤Á´«­¶Ã±®ÉIJµo¨Æ¥ó)»P¦@¦P¥ÀÅé(­¶Ã±ªº Parent ¬° ThisWorkBook)
¬G¦Ó¥i¥H¦b ThisWorkBook ¤W´M§ä¬O§_¦³¦X¾AªºÄ²µo¨Æ¥ó¥i¥H¹B¥Î,
¥i¯àªº¨Æ¥ó¦³ SheetChange »P SheetActivate.

¦bThisWorkBookªº¥ªÃä¿ï³æ¿ï ThisWorkBook, ¥kÃä¦A¤À§O¿ï¤W­z¨â­Ó¨Æ¥ó§Y¥i¦Û°Ê²£¥Í¬ÛÀ³ªºµ{§Ç,
  1. Private Sub Workbook_SheetActivate(ByVal Sh As Object)
  2. End Sub
½Æ»s¥N½X
  1. Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
  2. End Sub
½Æ»s¥N½X
±q¤W­zµ{§Ç©ïÀYªº()¤º®e¤¤¥i¥H¬Ý¥X¨Ó Sh ¥i¯à´N¬O§Ú­Ì·Q­nªº SheetName,
±µµÛ¥u­n¤À§O©ñ¤J MsgBox ¨q¥X Sh ¤º®e´N¥i¥H½T»{­þ­Ó¬O§Ú­Ì·Q­nªº¨Æ¥ó,
µM«á´N¬O¸ÕµÛ¹ê»Ú¤Á´«­¶Ã±¬Ý¬Ý¥H½T»{¨ì©³¬O·|IJµo¨º¤@­Óµ{§Ç¤F.
  1. Private Sub Workbook_SheetActivate(ByVal Sh As Object)
  2.   MsgBox ("§A¿ï¾Ü¤F " & Chr(34) & Sh.Name & Chr(34) & "­¶Ã±")
  3. End Sub
½Æ»s¥N½X
¤@¯ë¨Ó»¡±µ¨ü¨Ï¥ÎªÌ¿é¤J¤é´Á¥i¥H¥Î¿é¤J®Ø¡B¿ï³æ¤]¥i¥H¥ÎCalendar,
¦]¬°±Ä¥Î¿é¤J®Ø¿é¤J¤é´Á¥i¯à»Ý­n§@¿é¤J¤º®eªº¿ù»~³B²z,
¦Ó¿ï³æ«h»Ý­n³]©w¿ï³æ¦U¿ï¶µªì­È,
¬G«Øij¥Î Calendar ¸û²³æ.

¥u­nª`·N¶}ÀÉ®ÉÁôÂÃ,IJµo®ÉÅã¥Ü¥X¨Ó,¿ï¾Ü¤é´Á«áÀ³¦p¦ó§ì¨ú¸Ó¤é´Á¨Ã¦A¦¸ÁôÂçY¥i.
¦]»Ý­n¦b¦U­¶Ã±³£¯à¨Ï¥Î¬GÀ³©ñ¦b Sheet ¥~(§YModule <¦@¥Îµ{§Ç©Î¾ãÅéÅܼƫŧi> ©Î UserForm<¤¸¥ó>),
¥i¥ý«Ø¥ßªí³æ(UserForm)¦A©ñ¤J MonthView ¤¸¥ó¨Ó¹F¦¨,
¦Ó¦]¸Ó­¶Ã±¦WºÙ»Ý­n¦bªí³æ»P­¶Ã±¶¡¶Ç»¼¬GÀ³¦b¼Ò²Õ¤¤«Å§i¨ä¬° Public ¥H«K¾ã­ÓÀɮפ¤³£¯à¦@¥Î. (Public ­n©ñ¦b¼Ò²Õªº³Ì¤W­±)

(¥H¤Uµ{¦¡©ñ¦b ThisWorkBook)
  1. Private Sub Workbook_Open()
  2.   UserForm1.Hide ' Àɮ׶}±Ò®ÉÁôÂà UserForm(Calendar)
  3. End Sub
  4. Private Sub Workbook_SheetActivate(ByVal Sh As Object)
  5.   Shn = Sh.Name ' «O¦s©ÒÂI¿ïªº Sheet ¦WºÙ, ¥H«K¿ï¾Ü¤é´Á«á±N¤é´Á¶Çµ¹¸Ó­¶Ã±
  6.   UserForm1.Show ' Åã¥Ü Calendar ¥H«K¿ï¤é´Á
  7. End Sub
½Æ»s¥N½X
(¥H¤Uµ{¦¡©ñ¦b UserForm1)
  1. Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
  2.   Sheets(Shn).Range("P3") = DateClicked ' ±N¤é´Á³]©wµ¹©Ò¿ï­¶Ã±ªº P3 Àx¦s®æ¤º
  3.   UserForm1.Hide ' ÁôÂÃ UserForm(Calendar)
  4. End Sub
½Æ»s¥N½X
(¥H¤U«Å§i©ñ¦b Module ¤º)
  1. Public Shn$ ' «Å§i Sheet ¦WºÙ¥i¥H¦b¦Uµ{§Ç¤¤¦@¥Î
½Æ»s¥N½X
¦Ü©ó²Ä¤G­Ó°ÝÃD¦L¶H¤¤¥»ºô¯¸¤§«e¦³¤H°Q½×¹L, «Øij§A¥i¥H§ä§ä¬Ý.

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2011-9-25 09:01 ½s¿è

¦^´_ 1# fmsc168
°ÝÃD1:±Nµ{¦¡½X ½Æ»s¨ìVBA µøµ¡ªº ThisWorkbook ¤¤
  1. Private Sub Workbook_Open()
  2.     Call Workbook_SheetActivate(ActiveSheet)
  3. End Sub
  4. Private Sub Workbook_SheetActivate(ByVal Sh As Object)
  5.     Dim AA
  6.     Do While Not IsDate(AA) Or AA = ""
  7.         AA = InputBox("½Ð¿é¤J¤é´Á", , Date)
  8.     Loop
  9.     Sh.[P3] = AA
  10. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤@­Ó¤Hªº§Ö¼Ö¡D¤£¬O¦]¬°¥L¾Ö¦³±o¦h¡A¦Ó¬O¦]¬°¥L­p¸û±o¤Ö¡C
ªð¦^¦Cªí ¤W¤@¥DÃD