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

½Ð°Ý½Õ¾ã¤@ºû°}¦C¤j¤pªº¤è¦¡

½Ð°Ý½Õ¾ã¤@ºû°}¦C¤j¤pªº¤è¦¡

¦U¦ì¤j¤j :
½Ð±Ð¤@¤U, ¤p§Ì§Ú·Q¼g­Óµ{¦¡ , §â¬Y­Ó¼Æ(¦p10^6)¥H¤Uªº½è¼Æ¥þ³¡§ì¥X¨Ó
¤p§Ì§Ú¤£·Q¥Î§â½è¼Æ§ä¨ì«á , ³v¤@¼g¤JÀx¦s®æ¤è¦¡ , ³o¼Ë¤ñ¸ûºC
¦Ó¬O·Q¥Î , ¥ý½è¼Æ³v¤@¼g¤J¤@ºû°}¦C , ¦pReDim arr(1 To 10^6)
³Ì«á¦A§â³o¤@ºû°}¦C¶K¨ìÀx¦s®æ ¦p cells(1,1).resize(10^6, 1)=arr
§Ú·Q°Ý , ¦pªG§Úªº°}¦C¹w³]10^6¤j¤p , ¦ý¬O¨S¦³¼gº¡, ¨Ò¦p¥u¼g¤J10^5
§Ú­n¦p¦ó½Õ¾ã°}¦C¤j¤p , Åý°}¦C¥u«O¯d¦³¼g¤Jªº¦ì¸m(¨S¦³¼g¤Jªº§R°£)
ÁÂÁÂ~

¨Ò¦p¤U¤è²³æµ{¦¡, arr¹w³]10­Ó¦ì¸m , ³Ì«á¥u¦³arr(1) ~ arr(5)¦³¼g¤J¸ê®Æ
§Ú¦p¦ó§âarrÁY¤p¦¨¥u¦³5­Ó¦ì¸m? §â¨S¦³¼g¤Jªº¦ì¸m§R°£

Sub test()
ReDim arr(1 To 10)
n = 0
For i = 1 To 5
      n = n + 1
      arr(i) = n
Next
End Sub
MLB

¦^´_ 1# mlbolerud
«á­±¥[¤@¦æ
ReDim Preserve arr(1 To 5)
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

stillfish00¤j¤j
«D·PÁ§Aªº«Øij, ¦ý¬O§Úªº¨Ò¤l(10^6¥H¤Uªº½è¼Æ) , ­Ó¼Æ¦³¦h¤Ö, §Ú¤@¶}©l¤£·|ª¾¹D
©Ò¥H§Ú¤@¶}©l¥u¯à«Ø¤@­Ó«Ü¤jªº¤@ºû°}¦C(ÁקK¼g¤£¤U) , µM«á§â½è¼Æ§ä¨ì«á³v¤@¼g¤J
³Ì«á¼g§¹ , ¨S¦³¶ñº¡ªº°}¦C¦ì¸m , §Ú·Q­n§â¥¦§R°£
§Úª¾¹D¥i¥H¥Î¼g°j°éªº¤è¦¡ , §PÂ_°}¦C¸Ìªº­Èlen¬O§_=0 , ­pºâ½è¼Æ­Ó¼Æ
¦ý¬O¤£ª¾¹D¦³¨S¦³¤£¼g°j°éªº«ü¥O¥i¥H¥Î?
·PÁ¤F~
MLB

TOP

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2020-1-9 13:24 ½s¿è

¦^´_ 3# mlbolerud
¨S¦³­n§A¦A¥Î¤@­Ó°j°é¡A§A§PÂ_¬O½è¼Æ©ñ¨ìarrªº®É­Ô´N­n¶ë¨ì«e­±
  1. Sub Test1()
  2.     Dim arr(1 To 100)
  3.     Dim cnt As Long
  4.    
  5.     cnt = 0
  6.     For i = 1 To 100
  7.         If ¬O½è¼Æ(i) Then
  8.             cnt = cnt + 1
  9.             arr(cnt) = i
  10.         End If
  11.     Next
  12.    
  13.     ReDim Preserve arr(1 To cnt)
  14. End Sub
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¥»©«³Ì«á¥Ñ mlbolerud ©ó 2020-1-9 21:38 ½s¿è

stillfish00¤j¤j
«D±`·PÁ§A«Øijªº¤è¦¡ , ³o¬O«Ü¦nªº«Øij
¥Î³o­Ó¤è¦¡ , ½T¹ê´N¥i¥H¦b°j°é¶]§¹´N±o¨ì , °}¦C¼g¤Jªºªø«×

§Ú¥t¥~¦A½Ð±Ð­Ó¤p°ÝÃD, ¦pªG§Úªº¤@ºû°}¦Cªø«×¤ñ¸ûªø, ¨Ò¦p10^5
§Úµo²{¼g¤JÀx¦s®æ®É·|¥X²{ "«¬ºA¤£²Å¦X" ªº¿ù»~
¦pªG°}¦Cµu¤@ÂI(<=65536) , ´N¥i¥H¼g¤J , §Ú¥Î¤°»ò¤è¦¡¥i¥H¸Ñ¨M³o°ÝÃD©O?
§Ú¸Õ¹L§â°}¦C«Å§i¦¨ªø¾ã¼Æ( Dim arr() As long ) ¨S¦³¥Î, ¦p¤U½d¨Ò
ÁÙ±æ¤j¤j¯à¤£§[½ç±Ð
·PÁ¤F

Sub test1()
Dim arr() As Variant
ReDim arr(1 To 10 ^ 5)
n = 1
Do
      arr(n) = n
      n = n + 1
Loop While n < 10 ^ 5 + 1
Sheets(2).Cells(1, 1).Resize(10 ^ 5, 1) = Application.Transpose(arr)  ''''''''''' µLªk¼g¤J
End Sub
MLB

TOP

¦³Ãö°}¦C¤Óªø(>65536) , µLªk¼g¤JÀx¦s®æªº°ÝÃD
¦³­þ¦ì¤j¤j©Î«e½ú¥i¥HÀ°¦£¸Ñ´b¶Ü? ÁÙ¬O³oÃD¯uªºµL¸Ñ¤F?
ÁÂÁÂ~
MLB

TOP

¦^´_ 6# mlbolerud


¸ê®Æ¦æ¼Æ¤Ó¦h, 2003ª©, ³æÄæ©ñ¤£¤U, ¥i¥Î¦hÄæ~~

TOP

«D±`·PÁ±zªº¤À¨É~
MLB

TOP

        ÀR«ä¦Û¦b : «H¤ß¡B¼Ý¤O¡B«i®ð¤TªÌ¨ã³Æ¡A«h¤Ñ¤U¨S¦³°µ¤£¦¨ªº¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD