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

[µo°Ý] ¦p¦ó±N°}¦C¤À°Ï¬q¾ãÄæ©ÎªÌ¾ã¦Cªº¼g¤JÀx¦s®æ

[µo°Ý] ¦p¦ó±N°}¦C¤À°Ï¬q¾ãÄæ©ÎªÌ¾ã¦Cªº¼g¤JÀx¦s®æ

½Ð±Ð¦U¦ì¥ý¶i¡A¸Ó¦p¦ó±Nµ{¦¡¤¤°}¦CDATAªº³¡¥÷¸ê®Æ¾ãÄæ¼g¤JÀx¦s®æ¤º¡A¤p§Ì¤£ª¾¦bÆ[©À¤W­þ¸Ì¿ù»~¤F¡A½Ð¦U¦ì¥ý¶i±Ð¾É¡C
  1. Sub test()
  2. Dim Rng As Range, data(33, 24), i%, j%
  3. With Sheet1
  4. For i = 1 To 33
  5.     For j = 1 To 12
  6.         data(i, j) = Cells(i + 5, j + 8)
  7.     Next
  8. Next
  9. For i = 1 To 33
  10.     For j = 13 To 24
  11.         data(i, j) = Cells(i + 50, j - 4)
  12.     Next
  13. Next
  14. End With
  15. Set Rng = Sheet2.Range("B1:D24")
  16. For i = 1 To Rng.Columns.Count
  17. Rng.Columns(i) = Application.Index(Application.Transpose(data), , i)
  18. Next

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

test.rar (15.81 KB)

½Ð±Ð¦U¦ì¥ý¶i¡A¸Ó¦p¦ó±Nµ{¦¡¤¤°}¦CDATAªº³¡¥÷¸ê®Æ¾ãÄæ¼g¤JÀx¦s®æ¤º¡A¤p§Ì¤£ª¾¦bÆ[©À¤W­þ¸Ì¿ù»~¤F¡A½Ð¦U¦ì¥ý ...
sptakung1 µoªí©ó 2012-9-15 00:30
  1. Sub Ex()
  2.   Dim Rng As Range, data(33, 24), i%, j%
  3.   With Sheet1
  4.     For i = 0 To 32
  5.       For j = 0 To 11
  6.         data(i, j) = .Cells(i + 6, j + 9)
  7.       Next
  8.     Next
  9.     For i = 0 To 32
  10.       For j = 12 To 23
  11.         data(i, j) = .Cells(i + 51, j - 3)
  12.       Next
  13.     Next
  14.   End With

  15.   With Sheet2
  16.     .Select
  17.     .[A2].Resize(33, 24) = data
  18.     .Range(Columns(1), Columns(24)).AutoFit
  19.   End With
  20.   
  21.   With Sheet3
  22.     .Select
  23.     .[B1].Resize(24, 33) = Application.Transpose(data)
  24.     .Range(Columns(2), Columns(34)).AutoFit
  25.   End With
  26.   
  27. End Sub
½Æ»s¥N½X
test_ans.zip (17.86 KB)

TOP

[attach]12503[/attach
luhpro ¤j¤j±z§Ö³tªº¦^ÂСA¨Ï§Ú¥Ñ°Jªº·P¿E¡C¥Ñ©ó§Úªº±Ô­z»y²j¤£¸Ô³y¦¨±zªº»~·|¡A¦b¦¹¦V±z­P·N¡C§Úªº»Ý¨D¬O¨Ì¾Úªþ¥ó(test2.xls)¤¤³øªí1ªº¸ê®Æ¡A¨Ó¹F¦¨³øªí2¤Î³øªí3ªº»Ý¨D¡A­Y¬O¥i¦æªº¸Ü½Ð¦AÀ°¦£¤@¤U¡AÁÂÁ±z¡C­P¤W§Ú³Ì¤jªº¯¬ºÖ§Æ±æ±z®É®É¦N²»¦p·N¡C

test2.rar (24.18 KB)

TOP

¤]³\¦³¤j¤j·|½èºÃ¡A¨ä¹ê¦p¤W¼Ó©Ò­zªº»Ý¨D¡A¥u­n²³æªºcopy´N¥i¥H¤F¡A·F¹À¦p¦¹¤j¶O©P³¹©O¡H¨ä¥D¦]«Y§^¤H¤@ª½¥H¨Ó¹ï°}¦Cªº¾Þ§@¤£¬Æ¼ô¸Z·QÂǦ¹½m²ß¨Ï¥Îindex¡ATRANSPOSEµ¥¨ç¼Æ¡C¸g¹L¤@¦­¤WªººN¯Á¡A¦ü¥G¤w¦³¨Ç±ÙÀò¡A¥Ø«e¥i±o¨ì¦Û¤vªº»Ý¨D¡A¦ý¦s¦³¤pbug¡C±¡§Î¬O¨Ì¦p¤Uªº¥N½X°õ¦æ«á·|³y¦¨sheet3ªºbÄæ§Î¦¨ªÅ¥Õ¡A¦ý§Ú©ú©ú¬O±qb1¶}©lªº¡A¤£ª¾¦³­þ¦ì¤j¤j¥i¬°§Ú¸Ñ´b¡CÁÂÁ¡I
  1. Sub test1()  '¿é¥X«e3¦C
  2. Dim rng1 As Range, data(33, 24), i%, j%
  3. With Sheet1
  4. .Select      '¤§«e¦]¤Ö¤F³o¦C¡A¨Ï±oµ²ªG³£¨S¤ÏÀ³
  5. For i = 1 To 33
  6.     For j = 1 To 12
  7.         data(i, j) = Cells(i + 5, j + 8)
  8.     Next
  9. Next
  10. For i = 1 To 33 test3.rar (16.69 KB)
  11.     For j = 13 To 24
  12.         data(i, j) = Cells(i + 50, j - 4)
  13.     Next
  14. Next
  15. End With
  16. With Sheet3
  17. .Select
  18. Set rng1 = .Range("B1:AI3")
  19. End With
  20. For i = 1 To rng1.Rows.Count
  21. rng1.Rows(i) = Application.Index(Application.Transpose(data), i + 1)
  22. Next

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

TOP

©w¸qdata(33, 24)°}¦C¬O±q0¶}©l
¦Ó¸ü¤J¼Æ¾Ú®É
For i = 1 To 33
    For j = 1 To 12
        data(i, j) = Cells(i + 5, j + 8)
³o¼Ë data(0,0) ¨S¦³½á­È¡A³o¬ObÄæªÅ¥Õªº­ì¦]
¥i¥H§ï¬°data(1 To 33, 1 To 24)
©Î«e­±¥[¤WOption Base 1±j¨î°}¦C¤U¼Ð±q1¶}©l

TOP

¦^´_ 5# chin15
chin¤j¤j«D±`·PÁ¡A¥N½X¸g¦p¤U­×§ï¤w¯à¥¿±`¹B§@¡A°J¤ß·P¿E¡C¦Ü¤W§Ú³Ì²`ªº¯¬ºÖ
TEST3.xls¥N½X­×§ï¦p¤U¡G
1.¥N½X³Ì¤W¤è¥[¤JOption Base 1
2.#18  Set rng1 = .Range("B1:AI3")  AI3§ï¦¨AH3
3.#21  rng1.Rows(i) = Application.Index(Application.Transpose(data), i + 1) I+1§ï¦¨I

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD