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

[µo°Ý] °}¦Cªº­È©ñ¸m¨ìexcelªº°ÝÃD

[µo°Ý] °}¦Cªº­È©ñ¸m¨ìexcelªº°ÝÃD

RNG=[A5].CURRENTREGION'°²³]UBOUND(RNG)=20 ,UBOUND(RNG,2)=10
Q1 : [A1].Resize(20, 10).Value =RNG'§Úı±o³o¬O±N°}¦C¸ê®Æ©ñ¦bexcel«D±`§Öªº¤è¦¡,¤£¾å±oÁÙ¦³§ó§ÖªºÀ¨?
Q2 : ¦pªGRNG³o­Ó°}¦C,§Ú§Æ±æ¥¦¥ÑRNG(2 TO 16,3 TO 5) ©ñ¨ì [A1].Resize(15, 3).Value³o¸Ì­±¸Ó¦p¦ó°µ?¦]¬°¥Ø«eQ1µ{¦¡½XµLªk¹F¦¨³oºØ©ñ¸m¤è¦¡
PS:¦³¨S¦³µª®×¤£¬O°j°éªº.CELLS(x,x)=RNG(X,X)ªº¤è¦¡
PKKO

¦^´_ 1# PKKO
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub EX()
  3.     Dim Rng()
  4.     With Range("D1").CurrentRegion
  5.         Rng = .Cells(2, 3).Resize(15, 3).Value
  6.     End With
  7.     [A1].Resize(15, 3) = Rng
  8. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-6-21 16:22 ½s¿è

¦^´_ 2# GBKEE


   §Ú·QPKKO¤j¤jªº·N«ä¬O¦³­ÓRng(1 to 20,1 to 10)ªº°}¦C
¦ý¥L¥u¨úRNG(2 TO 16,3 TO 5)½d³òªº­È¡A¥i¦³¿ìªk¤£¥Î¥ô¦ó°j°é
´N¥i¥Hª½±µ¨ú¥Xªº·N«ä

TOP

¦^´_ 3# lpk187
¥u¨úRNG(2 TO 16,3 TO 5)¡A¥i¦³¿ìªk¤£¥Îfor...next

³o¤£¬O¤£¥Î°j°é?
  1. With Range("D1").CurrentRegion
  2.        Rng = .Cells(2, 3).Resize(15, 3).Value
  3.     End With
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ lpk187 ©ó 2015-6-21 16:34 ½s¿è

¦^´_ 4# GBKEE


  PKKOªº·N«ä¬ORng(1 to 20,1 to 10)¤w¸g¦³­È¤F¡A¤£¬O¦A¥h¨ú
With Range("D1").CurrentRegion
       Rng = .Cells(2, 3).Resize(15, 3).Value
    End With
ªº­È¡A¦Ó¥L¥u·Q§âRNG(2 TO 16,3 TO 5)½d³òªº­È¨ú¥X

TOP

¦^´_ 5# lpk187
¼Ó¥D¤£¬O»¡,¥i¦³¿ìªk¤£¥Îfor...next
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


    ©êºp,¬O§Ú¨S»¡²M·¡,Á|¨Òªº¤£¤Ó¬¢·í

¶Wª©¤j¤j±zªº¤è¦¡¤]«Ü¦n
¦ý°²³]§Úªº°}¦C¨Ã¤£¬O¥Ñexcel©Ò²£¥Íªº
¦Ó¬O§Ú¦Û¤vµ¹¥Lªº
DIM AA(1 TO 10,1 TO 5)
µM«á±N¹Bºâ¹Lªº­È³£¿é¤J¨ì°}¦C¤º¤§«á

¦³¨S¦³¬Æ»ò¤è¦¡¥i¥H¤£³z¹L°j°é
ª½±µ±N°}¦C¤¤¬Y¤@¬qªº¸ê®Æ©ñ¸m¨ìexcel¤º
¥­±`³£¬Oª½±µ¨Ï¥Î[A1].RESIZE(1 TO 10,1 TO 5).VALUE=AA
¥i¬O¦pªG§Ú­nªº¥u¬OAA¸Ì­±ªº(3 TO 10, 3 TO 5)
³o¼Ë­n¦p¦ó¤@¦¸©ñ¨ìexcel¤º?
¦³¿ìªkÃþ¦ü[A1].RESIZE(1 TO 10,1 TO 5).VALUE=AA³oºØªº¤è¦¡¶Ü?
PKKO

TOP

¥»©«³Ì«á¥Ñ mpegwmvavi ©ó 2015-6-21 23:44 ½s¿è

¦^´_ 7# PKKO


§Ú·Q¤£¨ì¤@¦¸©Ê¸m¤Jªº¤èªk,
¤£¹L¤@±ø¤@±ø(ª½©Î¾î)©ñ¶i¥h¬O°µ±o¨ìªº
¤èªk¬O¥ÎIndex³o­Ó¤u§@ªí¨ç¼Æ
¤£¹LÁÙ¬O­n°j°é¤T¦¸,¾¨ºÞ¦p¦¹,¤ñ°j°ém*n¦¸­n§Ö±o¦h¤F

For j=3 to 5
    Cells(1,j-2).Resize(10-3,1)=Application.Index(AA,0,j)
Next

°Ñ¦Òºô¯¸:
https://usefulgyaan.wordpress.com/2013/06/12/vba-trick-of-the-week-slicing-an-array-without-loop-application-index/
MPEG

TOP

¦^´_ 8# mpegwmvavi
¤@½g¤£¿ùªº½×­z¡AÁÂÁ§Aªº³ö¨Ñ¡I

TOP

¦^´_ 8# mpegwmvavi


    ¨S·Q¨ìÁÙ¦³³oºØ¤èªk¡A¯u¬O¤Ó·PÁ¤F¡I
PKKO

TOP

        ÀR«ä¦Û¦b : ¡i¦æµ½­n¤Î®É¡j¦æµ½­n¤Î®É¡A¥\¼w­n«ùÄò¡C¦p¿N¶}¤ô¤@¯ë¡A¥¼¿N¶}¤§«e¤d¸U¤£­n°±º¶¤õ­Ô¡A§_«h­«¨Ó´N¤Ó¶O¨Æ¤F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD