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

[µo°Ý] ¦b¨C¦C²Ä1Äæ¿é¤Jµ§¼Æ, ¨Ìµ§¼ÆÂлs¨C¦C°T®§«á¥t¦s¦¨¤@­Ó·sÀÉ

[µo°Ý] ¦b¨C¦C²Ä1Äæ¿é¤Jµ§¼Æ, ¨Ìµ§¼ÆÂлs¨C¦C°T®§«á¥t¦s¦¨¤@­Ó·sÀÉ

¥»©«³Ì«á¥Ñ melvinhsu1105 ©ó 2011-5-12 00:20 ½s¿è

¦A½Ð°Ý, ¦U¦ì¥ý¶i¤Î¦Ñ®v,

¤p§Ì, §Æ±æ¦b¤@¸ê®Æªí¤ºªº²Ä1Äæ, ¿é¤J»ÝÂлsªºµ§¼Æ, ¦Ó«á¦b°õ¦æ¥¨¶°, ¨Ì¨C¦C²Ä1Ä檺µ§¼Æ,Âлs«á, ¦A¥t¦s(¶})¤@·sÀÉ, ¤£ª¾À³¦p¦ó»s§@.



¦^´_ 1# melvinhsu1105
¦P¼Ëªº°ÝÃD  Âлs«á???
http://forum.twbts.com/redirect.php?goto=findpost&pid=19728&ptid=3503 3

TOP

¥ý¶i¡A¤£¬O¦P¼Ë°ÝÃD¡A𣎴¦n·N«ä¡C

¥t¡A©ÒÂлs¤§®æ¦¡¡A°£¦b­ì¸ê®Æªí²Ä¤@Äæ¥~¡A¨ä¾l¬Ò¨Ì¿ï¨úªº¦C¸ê®Æ¨Ìµ§¼Æ¥þ¼Æ¡]¥¼Áä¤Jµ§¼Æªº¦C¸ê®Æ¡A¤£Âлs¡^¦b·sªº¤u§@ªíªº²Ä¤@¦C¡A²Ä¤@Äæ¨Ì§Ç¶K¤W¡C

¦p¦³¤£²M·¡¤§³B¡A¦A«ü±Ð

TOP

¦^´_ 3# melvinhsu1105
¬O³o¼Ë¶ý?
  1. Option Explicit
  2. Sub Ex()
  3.     Dim AR(), C%, i%, ii%
  4.     ReDim AR(0)                                         'ReDim:­«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡ ->0¨ì0
  5.     With ActiveSheet
  6.         C = .[B1].End(xlToRight).Column                  '¨úªº:B1©¹¥k³sÄò¸ê®ÆªíÀY³Ì«áªºÄæ¦ì¼Æ
  7.         AR(0) = .Range("B1", .Cells(1, C)).Value         '«ü©w:°}¦Cªº¤¸¯À­È
  8.         For i = 2 To .Cells(2, "A").End(xlDown).Row      '°j°é:±qA2¶}©l©¹¤Uª½¨ì¨S¸ê®Æªº¦C¦ì
  9.             For ii = 1 To .Cells(i, "A").Value           '°j°é:±q1¶}©l¨ì.Cells(i, "A").Value =½Æ»sªºµ§¼Æ
  10.                 ReDim Preserve AR(UBound(AR) + 1)        'ReDim:­«·s°t¸m°ÊºA°}¦CÅܼƪºÀx¦sªÅ¶¡->­ì¦³ºû¼Æ+1
  11.                 'Preserve:·í§ïÅܭ즳°}¦C³Ì«á¤@ºûªº¤j¤p®É¡A¤´µM«O¦³­ì¨Óªº¸ê®ÆªºÃöÁä¦r¡C
  12.                 'UBound:ªí¥Ü«ü©w°}¦C¬Yºû³Ì¤j¥i¨Ï¥Îªº°}¦C¯Á¤Þ
  13.                 AR(UBound(AR)) = .Range(.Cells(i, "B"), .Cells(i, C)).Value '«ü©w:°}¦C³Ì¤jªº¤¸¯À­È
  14.             Next
  15.         Next
  16.     End With
  17.     With Workbooks.Add.Sheets(1).Range("A1")   'With: ¦b¤@­Ó³æ¤@ª«¥ó©Î¤@­Ó¨Ï¥ÎªÌ¦Û­q«¬ºA¤W°õ¦æ¤@¨t¦Cªº³¯­z¦¡¡C
  18.         For i = 0 To UBound(AR)                '°j°é:±qARªº²Ä1­Ó¤¸¯À(0)¨ìARªº³Ì¤j¤¸¯ÀUBound(AR)
  19.             .Offset(i).Resize(, C - 1) = AR(i) '.Offset(i):¦b¦¹iªí©¹¤Uªº¦C¼Æ
  20.             '.Resize(, C - 1): ÂX¥Rªº½d³ò¬°(1¦C,C - 1Äæ)=°}¦C¤¸¯Àªº­È
  21.         Next
  22.     End With
  23. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# GBKEE


ªO¥D, ·PÁ±z¤@ª½­@¤ß¦^ÂÐ, ¦Ó ­è§Q¥Î§A¦^ÂЪº½X®M¥Î, ¦ü¥GµLªk°õ¦æ. ¦ý¤]¨S¦³µ{¦¡°»¿ùªº°T®§.

TOP

­è§Q¥Î§A¦^ÂЪº½X®M¥Î, ¦ü¥GµLªk°õ¦æ. ¦ý¤]¨S¦³µ{¦¡°»¿ùªº ...
melvinhsu1105 µoªí©ó 2011/5/11 09:57

§Ú¤]¤£ª¾¹D?  ¨S¬Ý¨ì§AªºÀÉ®×  ¤£ª¾§A¦p¦ó®M¥Î   [¦P¼Ëªº°ÝÃD]

PS:   2¼Ó  ¦P¼Ëªº°ÝÃD ->§A¨S±N§A½T¤Á·Qªk»¡¸Ô²Ó ¥Î½d¨Ò¨Óªí¹F.

TOP

¦A¸É¤W·Q§¹¦¨ªº½d¦C¹Ï, ¦A½ÐªO¥DÀ°¦£. ¤£¦n·N«ä¤F.

TOP

¦^´_ 7# melvinhsu1105
  1. Sub ex()
  2. Dim Ar()
  3. With ActiveSheet
  4. a = .Range("A1").CurrentRegion
  5. ReDim Preserve Ar(s)
  6. Ar(s) = Application.Index(a, 1)
  7. s = s + 1
  8. For i = 2 To UBound(a, 1)
  9.    For j = 1 To a(i, 1)
  10.       ReDim Preserve Ar(s)
  11.       Ar(s) = Application.Index(a, i)
  12.       s = s + 1
  13.    Next
  14. Next
  15. End With
  16. With Workbooks.Add
  17.   .Sheets(1).[A1].Resize(s, UBound(a, 2)) = Application.Transpose(Application.Transpose(Ar))
  18.   .Sheets(1).Columns("A").Delete
  19.   '.SaveAs "D:\Test.xls" '·sÀɦsÀɥؿý¦Û¦æ­×§ï
  20. End With
  21.   
  22. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 8# Hsieh


    ¦Ñ®v, ÁÂÁ§Aªº¦^À³.

¦Ó¤p§Ì§Ú¦bª½±µÂлs¤W«á,  °õ¦æ, ¥¼¦³¥ô¦ó§@¥Î, ­ì¦]¬°¦ó, ? ¤w¦b¸É¤W·Ó.

¦h¦³³Ò·Ð.

TOP

¥»©«³Ì«á¥Ñ luhpro ©ó 2011-5-12 00:49 ½s¿è

¦^´_ 9# melvinhsu1105

¥i¯à¬O§Aµ{¦¡½X©ñ¿ù¦a¤è¤F.
Sub ex() »P³Ì©³¤Uªº End Sub ³£¤£­n Copy,
¥u Copy ¤¤¶¡ªºµ{¦¡½X´N¦n,
µM«áÂI¨â¤U CommandButton1 ¥¦·|¦Û°Ê«Ø¥ß :

Private Sub CommandButton1_Click()

End Sub


§â Copy ªºµ{¦¡½X©ñ¦b¤W­z¨â¦æ Sub ±Ô­zªº¤¤¶¡§Y¥i.

TOP

        ÀR«ä¦Û¦b : ¨Ã«D¦³¿ú¾{¬O§Ö¼Ö¡A°Ý¤ßµL·\¤ß³Ì¦w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD