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

[¤À¨É] °}¦C±Æ§Ç¤è¦¡

[¤À¨É] °}¦C±Æ§Ç¤è¦¡

Sub TOP_Value()
    '±Æ§Ç
    Dim TT As Variant
   
    TT = Array(5, 4, 2, 1, 2)

    '¥Ñ¤j¨ì¤p±Æ§Ç
    MsgBox Application.WorksheetFunction.Large(TT, 1)
    MsgBox Application.WorksheetFunction.Large(TT, 2)
    MsgBox Application.WorksheetFunction.Large(TT, 3)
    MsgBox Application.WorksheetFunction.Large(TT, 4)
    MsgBox Application.WorksheetFunction.Large(TT, 5)
   
    '¥Ñ¤p¨ì¤j±Æ§Ç
    MsgBox Application.WorksheetFunction.Small(TT, 1)
    MsgBox Application.WorksheetFunction.Small(TT, 2)
    MsgBox Application.WorksheetFunction.Small(TT, 3)
    MsgBox Application.WorksheetFunction.Small(TT, 4)
    MsgBox Application.WorksheetFunction.Small(TT, 5)
End Sub

¤£¦n·N«ä,§Ú¤~­è¾ÇVBA,¹ïArrayªº¥Îªk¤£¬O¤Ó¹L¦³·§©À,¥i¥H±Ð§Ú¤@¤U¶Ü?
¦pªG¥i¥H¦³Â²©ö©úªº¨Ò¤l»¡©ú¤@¤U´N¦n¤F,ÁÂ!
50 ¦r¸`¥H¤º
¤£¤ä«ù¦Û©w¸q Discuz! ¥N½X

TOP

¦^´_ 1# Min


    ³q±`°}¦C¤½¦¡
³£¬O¼gªº«Ü½ÆÂø
ª©¥D¼gªº«Ü®e©öÀ´
ÁÂÁÂ!!

TOP

¤£¦n·N«ä,§Ú¤~­è¾ÇVBA,¹ïArrayªº¥Îªk¤£¬O¤Ó¹L¦³·§©À,¥i¥H±Ð§Ú¤@¤U¶Ü?
¦pªG¥i¥H¦³Â²©ö©úªº¨Ò¤l»¡©ú¤@¤U´N¦n ...
am0251 µoªí©ó 2010/5/4 11:25 PM


¨ä¹êArrayÆ[©À¤£Ãø!
´N­«¤@ºû°}¦Cªº«¬ºA¶}©l»¡°_...
¥Hexcel cells¨Ó»¡ ¤@ºû°}¦C´N¹³¬O¥u¦³¤@Ä檺¸ê®Æ«¬ºA ex.¥u¦³A1~A65536
¨ºcells¥u¯à¥Îcells(1,1) cells(2,1) cells(3,1)....cells(65536,1) ©Ò¥H´N¥u¦³row¥i¥H¥Î!
dim arr()
arr(0) arr(1) arr(2)....arr(65536)
¦ý¶·ª`·Nªº¬Oarray¹w³]¬O¥Ñ0¶}©l!

¤Gºû°}¦C§ó¬O²³æ excelªºcells¥»¨­´N¬O¤Gºû
cells(1,1) ´N¦p¦Parr(0,0)
cells(123,321) ´N¦p¦Parr(123,321)

¨º¤T³ò... ¿ù¬O¤Tºû°Õ! >"<
¤Tºû°}¦C´N­n·Q¹³¬O¥ßÅéªÅ¶¡¤F!

·|¤£·|ÁÙ¦³¤H°Ý¥|ºû°}¦Cªü~
¥|ºû.... ¥|ºû¥i¥HºÙ¥|«×ªÅ¶¡>"< ºâ¤F!§Ú¤£ª¾¹D«ç»ò¸ÑÄÀ...

TOP

ªO¥D
±z¤£­n³o¼Ë....
³o¼Ë
§Ú­Ì­n¦V±z¾Ç²ßªº¤H¤]·|·W¤F¤â¸}³á!!
¦pªG±zı±o¤£ª¾¹D­n¦p¦ó¸ÑÄÀªºÅý§Ú­Ì³o¨Çªì¾ÇªÌ©öÀ´
¤£³X±z¥ý¦bµ§°O¥»¤W¥ý¼g¦n±z­n§i¶D§Ú­Ì³o¨Çªì¾ÇªÌªºªF¦è
²LÅã©öÀ´
¬O§Ú­Ì»Ý­nªº...¦ý¬O¤]¬O±zª©¥D¨¯­W±o¦a¤è...ª¾©ö¦æÃø!!!
·PÁ±z!!!!µL¨p©^Äm!

TOP

¥»©«³Ì«á¥Ñ Hsieh ©ó 2010-5-7 21:54 ½s¿è

¦^´_ 5# PD961A


    ²LÅã©öÀ´ªº¤å¦r±Ô­z?
¨º¦U¦ìª©¥D´N¥ý¨Ó¥h­×»y¤å½Òµ{
§â»y¨¥ºë·Ò«á¦A¨Óµo¤å
¶}¶}ª±¯º°Õ!
°}¦C:
¬Û«H¹ï¤@ºû°}¦Cªº¸Ü¤j®a¤ñ¸û®e©ö±µ¨ü
´N¤@°ï¸ê®Æ³W«hªº©ñ¤J¤@±Æ¤º´N¬O¤@ºû°}¦C
¥H¹êª«Á|¨Ò
¤j®a¦³¤W¹L¾Ç,¾Ç®Õ¦³´Â·|©Î¥ô¦ó¥þ®Õ¨ì¾Þ³õ¶°¦Xªº¸gÅç§a!
·í­n¦U¯Z¾ã¶¤®É
¯Zªø»¡±ÆÀY¥î¬°·Ç
³o¤@¥îªº¦¨­û´N¬O¤@ºû°}¦Cªº¤¸¯À
§Ú­Ì§â³o±ÆÀY©³¤U­n¹ï»ô¥Lªº³o¨Ç¤H
´N¬O¤Gºû°}¦Cªº²Ä¤Gºûªº¤¸¯À¤F
¦A§â¶°¦X¦nªº¯Z¯Å(¤Gºû°}¦C)
±a¨ì¾Þ³õ®É
¾Þ³õ¤W·|¤À¦~¯Å¯¸¦n
¨C¤@­Ó¦~¯Å´N·|¦³¦n¦h¯Z
³o¤@­Ó¦~¯Å´N¬O¦h­Ó¤Gºû°}¦Cªº¶°¦X(¤Tºû°}¦C)
¨C­Ó¾Ç®Õ·|¦³¦h­Ó¦~¯Å
¨º¶°¦X³o»ò¦h¦~¯Å(¤Tºû°}¦C)´N¦¨¤F¥|ºû°}¦C
³o¼Ë¹ï°}¦Cªº¸ÑÄÀ¤£ª¾¬O§_¤ñ¸û¹êÅé¤Æ
¤ñ¸û®e©ö¤F¸Ñ©O?
  1. Sub nn()
  2. Dim Ar(3, 10, 10, 4) '©w¸qAr¬°4ºû°}¦C:¨C¶¤4±Æ,¨C±Æ10¤H,¨C¦~¯Å¦³10¯Z,¦@¦³3­Ó¦~¯Å(¦~¯Å,¯Z,¤H,±Æ)
  3. k = 42048
  4. mystr = Chr(k)
  5. For y = 0 To 2
  6.    For x = 0 To 9
  7.        For i = 0 To 3
  8.          For j = 0 To 9
  9.          Do Until mystr <> "?"
  10.          k = k + 1
  11.          mystr = Chr(k)
  12.          Loop
  13.               Ar(y, x, j, i) = Chr(k): k = k + 1: mystr = Chr(k): Next: Next: Next: Next
  14. For y = 0 To 2
  15.    For x = 0 To 9
  16.        For i = 0 To 3
  17.          For j = 0 To 9
  18.              Cells(r + 1, 1) = y + 1 & "¦~" & x + 1 & "¯Z²Ä" & i + 1 & "±Æ²Ä" & j + 1 & "¦ì¦P¾Ç©m:": _
  19.              Cells(r + 1, 2) = Ar(y, x, j, i): r = r + 1: _
  20.              Next: Next: Next: Next
  21. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 4# Min
´N­«¤@ºû°}¦Cªº«¬ºA¶}©l»¡°_...
¥Hexcel cells¨Ó»¡ ¤@ºû°}¦C´N¹³¬O¥u¦³¤@Ä檺¸ê®Æ«¬ºA ex.¥u¦³A1~A65536

¦pªG:A = [A1:A65536]   ¾ãÄæ
A¬O(1  To 65536 ,  1) ªº¤Gºû°}¦C   
¦pªG:A = [A1:IV1]         ¾ã¦C
A¬O(1 , 1 To 256 ) ªº¤Gºû°}¦C

TOP

¦^´_ 6# Hsieh

ªO¥D±zªº²LÅã©öÀ´ªí¹F¤è¦¡..¦b¼g¨ì3ºû¤Î4ºû«á..¤Ï¦ÓÅý¤H¤£ª¾©Ò¤ª..
   
¶{ªO¥D±Ô­z´N¤@ºû°}¦Cªº«¬ºA
dim arr()
arr(0) arr(1) arr(2)....arr(65536)
¦ý¶·ª`·Nªº¬Oarray¹w³]¬O¥Ñ0¶}©l!

¤Gºû°}¦C§ó¬O²³æ excelªºcells¥»¨­´N¬O¤Gºû
cells(1,1) ´N¦p¦Parr(0,0)
cells(123,321) ´N¦p¦Parr(123,321)ªº¦^µª
©Mgbkeeª©¥D©Ò»¡ªº³£¤@¼Ë...
©Ò¥HÀ³¸Ó¬O¶¥¯ÅÁÙ¤£¨ì¼g¥X3ºû©Î4ºûªº°}¦C
¦]¦¹¨S¿ìªk·Q¹³
ÁÙ¬OÁÂÁ±z!

TOP

¦^´_ 8# PD961A


    §Ú©Ò»¡ªº¬O¦hºû°}¦Cªº·§©À¤j­P´N¹³±Æ¶¤¶°¦X¤@¼Ë
¥u¬O·í§A¦b¼g¦¨°}¦C»Pªk®É¬O¥Î¥LªºINDEXªí¥Ü
¦pDim Ar(0 to 10,0 to 20,0 to 10,0 to 30)
³o¼Ë´N«Å§i¤F¤@­Ó4ºû°}¦C
¥u­q¥X³o°}¦C¤¤²Ä¤@­Ó¤¸¯À´N¼g¦¨
Ar(0,0,0,0)
³Ì«á¤@­Ó¤¸¯À´N¬OAr(10,20,10,30)
²Ä¤@ºû¦³11­Ó¤¸¯À
²Ä¤Gºû¦³21­Ó¤¸¯À
²Ä¤Tºû¦³11­Ó¤¸¯À
²Ä¥|ºû¦³11­Ó¤¸¯À

Sub nn()
Dim Ar(11, 21, 11, 31)
For i = 0 To 10
   For j = 0 To 20
      For x = 0 To 10
         For y = 0 To 30
              Ar(i, j, x, y) = i + j + x + y: Next: Next: Next: Next
For i = 0 To 10
   For j = 0 To 20
      For x = 0 To 10
         For y = 0 To 30
              MsgBox "Ar(" & i & "," & j & "," & x & "," & y & ")=" & i & "+" & j & "+" & x & "+" & y & "=" & Ar(i, j, x, y): Next: Next: Next: Next
              
End Sub
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 9# Hsieh


    ªO¥D
±z¯uªº«Ü¥Î¤ß«Ü»{¯u
¨ä¹ê·í±z¼g¨ì3/4ºû°}¦C®É·í¤Uªºªí¥Ü¤è¦¡¯uªº¬O¤@ÀYÃú¤ô...
¤£¹L·í±zªá®É¶¡¦b¦^Âгo«Ê¥DÃD®É
©Ò¼g¥X¨Óªº°}¦C´N¬Û·í½Ð·¡¤F
¥u¬O·í®É·Q»¡¤£ª¾±z¥i¥H¼g¦¨³o¼Ëªº¤è¦¡¶Ü?
µ²ªG
¬Ý¨ì¦^©«
¥¿¬O·Q­nªí¹Fªº·N«ä
ÁÂÁÂ!!

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD