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

[µo°Ý] ½Ð°Ý¬O§_¦³¿ìªk«ö·Ó·í·Æ¹«ÂI¨ìªº¶¶§Ç¥h±Æ§Ç?(¤w§¹¦¨¡AÁÂHsieh¤j¤j)

[µo°Ý] ½Ð°Ý¬O§_¦³¿ìªk«ö·Ó·í·Æ¹«ÂI¨ìªº¶¶§Ç¥h±Æ§Ç?(¤w§¹¦¨¡AÁÂHsieh¤j¤j)

¥»©«³Ì«á¥Ñ av8d ©ó 2012-2-15 15:50 ½s¿è

§Ú­è¿ý»s¤F¤@­Ó¥¨¶°
    Range("C7").Select
    Application.CutCopyMode = False
    Selection.Cut
    Range("C2").Select
    Selection.Insert Shift:=xlDown

³o¬O§âC7°Å¤UµM«á¶K¨ìC2¤W¤èªº¥¨¶°


¬O§_¦³¿ìªkÅý°O¾ÐÅé°ïÅ|¸ê®Æ©O?
¨Ò¦p:«ö·ÓÂI¨ìªº¥ý«á¶¶§Ç¥h±Æ§Ç¡A
1.C2 ¡÷ C1
2.C5 ¡÷ C2
3.C3 ¡÷ C3
4.C4 ¡÷ C4
5.C1 ¡÷ C5
«ö·ÓÂIªº¶¶§Ç±q·s±Æ¦C¡C

¦^´_ 1# av8d

°²³]¸ê®Æ¦bAÄæ
¤u§@ªí¼Ò²Õ
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2. Application.EnableEvents = False
  3. If Target.Count = 1 Then
  4. If Target.Column = 1 Then
  5. ReDim Preserve Ar(s)
  6. Ar(s) = Target.Value
  7. s = s + 1
  8. [B65536].End(xlUp).Offset(1) = Target
  9. Target.Delete xlShiftUp
  10. End If
  11. End If
  12. Application.EnableEvents = True
  13. End Sub
½Æ»s¥N½X
¤@¯ë¼Ò²Õ
  1. Public Ar(), s&
  2. Sub «ö¶s1_Click()
  3. If s = 0 Then Exit Sub
  4. Application.EnableEvents = False
  5. [A1].Resize(s, 1).Insert xlShiftDown
  6. [A1].Resize(s, 1).Value = Application.Transpose(Ar)
  7. Range([B2], [B2].End(xlDown)).ClearContents
  8. s = 0: Erase Ar: Set Rng = Nothing
  9. Application.EnableEvents = True
  10. End Sub
½Æ»s¥N½X
play.gif
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 2# Hsieh


    ªO¤j©êºp~¦pªG¬OXPª©ªº¸Ü

¸Ó¦p¦ó§ï¼g©O?

XPª©·|Åã¥Ü

½sĶ¿ù»~:
ª«¥ó¼Ò²Õ¤¤ªºPublic¦¨­û¤£¥i¥H¬O±`¼Æ¡B©T©wªø«×ªº¦r¦ê¡B°}¦C¡B¨Ï¥ÎªÌ¦Û­q«¬ºA©ÎDeclare³¯­z¦¡

»¡©ú:
ª«¥óÃþ§O¼Ò²Õ¤¤ªº Public ¦¨­û¤£¥i¥H¬O¡G±`¼Æ¡B©T©wªø«×ªº¦r¦ê¡B¨Ï¥ÎªÌ©w¸q«¬ºA¡B°}¦C©Î Declare ³¯­z¦¡
¨Ã«D©Ò¦³ª«¥ó¼Ò²Õ¤¤ªºÅܼƳ£¥i«Å§i¦¨ Public¡CµM¦Ó¡Aµ{§Ç¦b¹w³]¤W¬O Public¡A¥B Property µ{§Ç¦b»yªkµ²ºc¤W¥i¤ñ·ÓÅܼơC³o­Ó¿ù»~ªº°_¦]»P¸Ñ¨M¤èªk¦p¤U©Ò¥Ü¡G
±z¦bª«¥ó¼Ò²Õ¤¤«Å§i¤F¤@­Ó Public ±`¼Æ¡C
ÁöµM±z¤£¯à¦bª«¥ó¼Ò²Õ¤¤«Å§i Public ±`¼Æ¡A¦ý±z¥i¥H¬Û¦P¦WºÙ«Ø¥ß¤@­ÓProperty Get µ{§Ç¡C­Y±z¤£¥H¬Û¦P¦WºÙ«Ø¥ß¤@­Ó Property Let ©Î Property Set µ{§Ç¡A±z¹ê»Ú¤W±N«Ø¥ß¤@­Ó°ßŪÄÝ©Ê¡A¨ä¥Îªk»P±`¼Æ¬Û¦P¡C

±z¦bª«¥ó¼Ò²Õ¤¤«Å§i¤F¤@­Ó Public «¬ºAªº©T©wªø«×¦r¦ê¡C
±z¥i¥Î Property µ{§Ç¼ÒÀÀ©T©wªø«×¦r¦ê¡A¨ÃºI±¼¶W¥Xªø«×ªº¦r¦ê¸ê®Æ¡A©Î´£¥Ü¨Ï¥ÎªÌ¶W¥Xªø«×¡C

±z¦bª«¥ó¼Ò²Õ¤¤«Å§i¤F¤@­Ó Public °}¦C¡C
ÁöµMµ{§Ç¤£¯à¶Ç¦^°}¦C¡A¦ý¥i¶Ç¦^¤@­Ó¥]§t°}¦Cªº Variant¡C­n¦Aª«¥óÃþ§O¼Ò²Õ¤¤¼ÒÀÀ¤@­Ó Public °}¦C¡A¥i¨Ï¥Î¤@²Õ¥i±µ¨ü»P¶Ç¦^¥]§t°}¦C¤§ Variant ªº Property µ{§Ç¡C

±z¦bª«¥ó¼Ò²Õ¤¤©ñ¤F¤@­Ó Declare ³¯­z¦¡¡C
Declare ³¯­z¦¡³£¬O¤½¥Îªº¡A±z¥i¦b Declare ³¯­z¦¡¤§«e¥[¤W¤@­Ó Private ÃöÁä¦r¡C

¸Ô²Ó¸ê°T¡A½Ð¥ý¿ï¨ú¦³ºÃ°Ýªº¶µ¥Ø¡AµM«á«ö¤U F1 (¦b Windows¤¤) ©Î HELP (¦b Macintosh¤W)¡C

TOP

¦^´_ 3# av8d
¨S¦³XPª©¥»¡A2003´ú¸Õ¥i¥H³q¹L
Book1.zip (8.52 KB)
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-2-15 16:03 ½s¿è

¦^´_ 4# Hsieh


    2003ª©¥i¥Î¡A¸U¤À·PÁ¡C

±z¦n~§Ú·Q¦b¸ß°Ý¤@¤U¦pªG­n½Õ¾ãA©MBÄæ¸Ó¦p¦ó­×§ï©O?

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2012-2-15 16:27 ½s¿è

¦^´_ 5# av8d


    ³]­p¼Ò¦¡¤U§ó§ïAÄæ¸ê®Æ
§ó§ï§¹¦¨«á¦Aµ²§ô³]­p¼Ò¦¡
play.gif
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ av8d ©ó 2012-2-15 16:47 ½s¿è

¦^´_ 6# Hsieh

»~·|¤F~§Úªº·N«ä¦¡AÄæ¦ì§ï¦¨CÄæ¦ì~BÄæ¦ì§ï¦¨DÄæ¦ì­n¦p¦ó­×§ï©O?
If Target.Count = 1 Then
If Target.Column = 1 Then

¬O1§ï¦¨3¶Ü?ÁÙ¬O­n­«¼g?

    ­è¦n°Ý¤@¤U~³]­p¼Ò¦¡©Mµ²§ô³]­p¼Ò¦¡~°µ¦¨¶}Ãö«ö¶s~¬O§_¦³¿ìªk?

¶¶«K°Ý¤@¤U«ü¥O«ö¶s¤@©w­n¼g¦bSHEET¸Ì­±¶Ü?
¦pªG¬O¡A½Ð°Ý±zªº«ö¶s¬O­þ¤@ºØ«ö¶s©O?¨S¦³¼g¦bSHEET¸Ì­±¬O¦]¬°©ÈÅܼƷ|½Ä¬ð¨ì¶Ü?ÁÙ¬O?

TOP

¥»©«³Ì«á¥Ñ register313 ©ó 2012-2-15 17:24 ½s¿è

B1.rar (8.3 KB) ¦^´_ 7# av8d

­×§ïHsieh¶Wª©¤§µ{¦¡
2­¿ªºµ{¦¡½X,°Ñ¦Ò

¤u§@ªí¼Ò²Õ
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2. Application.EnableEvents = False
  3. If Target.Count = 1 Then
  4. If Target.Column = 1 Then
  5.     ReDim Preserve Ar(s)
  6.     Ar(s) = Target.Value
  7.     s = s + 1
  8.     [B65536].End(xlUp).Offset(1) = Target
  9.     Target.Delete xlShiftUp
  10. ElseIf Target.Column = 3 Then
  11.     ReDim Preserve Ar1(t)
  12.     Ar1(t) = Target.Value
  13.     t = t + 1
  14.     [D65536].End(xlUp).Offset(1) = Target
  15.     Target.Delete xlShiftUp
  16. End If
  17. End If
  18. Application.EnableEvents = True
  19. End Sub
½Æ»s¥N½X
¤@¯ë¼Ò²Õ
  1. Public Ar(), Ar1(), s&, t&
  2. Sub «ö¶s1_Click()
  3. Application.EnableEvents = False
  4. If (s <> 0) Then
  5. [A1].Resize(s, 1).Insert xlShiftDown
  6. [A1].Resize(s, 1).Value = Application.Transpose(Ar)
  7. Range([B2], [B2].End(xlDown)).ClearContents
  8. s = 0: Erase Ar: Set Rng = Nothing
  9. End If
  10. If (t <> 0) Then
  11. [C1].Resize(t, 1).Insert xlShiftDown
  12. [C1].Resize(t, 1).Value = Application.Transpose(Ar1)
  13. Range([D2], [D2].End(xlDown)).ClearContents
  14. t = 0: Erase Ar1: Set Rng = Nothing
  15. End If
  16. Application.EnableEvents = True
  17. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD