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

[µo°Ý] ¦hºû¯x°}¤º¾Ü¨ú¨ä¤¤¤@ºûªº°}¦C¸ê®Æ¤¸¯À

[µo°Ý] ¦hºû¯x°}¤º¾Ü¨ú¨ä¤¤¤@ºûªº°}¦C¸ê®Æ¤¸¯À

¥»©«³Ì«á¥Ñ Scott090 ©ó 2014-4-28 20:58 ½s¿è

½Ð°Ý°ª¤â¥ý¶i¡G
¥Ñ©ó¯x°}¤º¼Æ¾Ú¦h¡A¤£·Q¥Î°j°éªº¤è¦¡¨Ó¨ú±o¤@­Ó­Óªº¤¸¯À¡F½Ð°Ý¦³¦óªk¥i¸Ñ?
¥H¤U¬°µêÀÀ VBA µ{§Ç¡G
  1. Sub qq()
  2. '½Æ¼Æ­Ó¤@ºû¯x°}²Õ¦¨°}¦C aa
  3. '===========================
  4. aa = Array(Array(123, 234, 345), Array("aaa", "bbb", "ccc"), Array(567, 678, 789))

  5. '±q¯x°} aa ¨ú±o ¯x°} bb
  6. '========================
  7. bb = aa(1)

  8. '§â¯x°} aa Âà´«¦¨ ¹ê»Úªº 3x3 ¯x°}
  9. '=================================
  10. cc = Application.Transpose(Application.Transpose(aa))

  11. '¦p¦ó¤£¥Î°j°éªº¤è¦¡§â cc ¯x°}¤¤ªº cc(2,1), cc(2,2), cc(2,3) Âà¤J dd()
  12. '====================================================================

  13. dd = cc((2))   '³o­Ó¬O¤£¹ïªº¡A¯ÂÄݥܷN


  14. End Sub
½Æ»s¥N½X

¦^´_ 1# Scott090
Transpose «á°}¦C¯Á¤Þ­È¤U­­±q1 ¶}©l.
  1. dd = Application.Index(cc, 2)  
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


    «D±`·P®¦¤j®vªº¸Ñ´b

TOP

¦^´_ 3# Scott090 GBKEE
¤À¨É¤@¤U­Ó¤H¸gÅç¡A°}¦C¤pªº¸Ü¡Aapplication.index«Ü¤è«K
¦ý¬O¤j¤@ÂIªº°}¦C¡A³o­Ó¨ç¼Æªº®Ä²v´N«Ü®t(¶V¤j¶V©úÅã)¡A
¦pªG¬O­«µø°õ¦æ®É¶¡ªº±¡ªp¤U¡A´NºÉ¶qÁÙ¬O¥Î°j°é¥h¨ú·|§Ö«Ü¦h¡C
  1. Sub testForIndex()
  2.   Dim ar2d(1 To 200, 1 To 500)
  3.   Dim test1, test2
  4.   Dim i As Long, j As Long
  5.   Dim t
  6.   
  7.   t = Timer
  8.   ReDim test1(1 To UBound(ar2d, 2))
  9.   For i = 1 To UBound(ar2d) 'µ¥©ó¶]¨â¦Ê¦¸
  10.     For j = 1 To UBound(ar2d, 2)
  11.       test1(j) = ar2d(i, j)
  12.     Next
  13.   Next
  14.   Debug.Print Timer - t   '¬ù0.027343¬í
  15.   
  16.   t = Timer
  17.   For i = 1 To UBound(ar2d) 'µ¥©ó¶]¨â¦Ê¦¸
  18.     test2 = Application.index(ar2d, i)
  19.   Next
  20.   Debug.Print Timer - t   '¬ù3.867188¬í
  21. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# stillfish00


    ÁÂÁ¤À¨É

TOP

        ÀR«ä¦Û¦b : ¡i¥Í©R¦b©I§l¶¡¡j¦òªû»¡¡G¡u¥Í©R¦b©I§l¶¡¡C¡v¤HµLªkºÞ¦í¦Û¤vªº¥Í©R¡A§óµLªk¾×¦í¦º´Á¡AÅý¦Û¤v¥Ã¦í¤H¶¡¡C¬JµM¥Í©R¥h¨Ó³o»òµL±`¡A§Ú­Ì§óÀ³¸Ó¦n¦n¦a·R±¤¥¦¡B§Q¥Î¥¦¡B¥R¹ê¥¦¡AÅý³oµL±`¡BÄ_¶Qªº¥Í©R¡A´²µo¥¦¯uµ½¬üªº¥ú½÷¡A¬M·Ó¥X¥Í©R¯u¥¿ªº»ù­È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD