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

·s¤âµo°Ý - ½Ð°Ý

·s¤âµo°Ý - ½Ð°Ý

·s¤â­n¾ÇExcel VBA »Ý­n¥ý¥Ñ¨º³¡¤À¾Ç°_©O?
¦³¥h¨¦ºq¤F¤@¨Çºô¯¸
¦ý¬O¥ú Dim («á­±¤@°ï©R¦W´N·d¤£À´¤F)
Ex: Dim x as long
     Dim x as integater
     Dime arr()
³o¬Ovba ¶}ÀY¤@©w­n°µªºªF¦è¶Ü??

¥t¥~°Ý¤@¤U®ç¶é©Î¨º¸Ì¦³±M·~¾ÇExcel VBAªººô¯¸¶Ü?
­Y¦³ªº¸Ü¥ç³Â·Ð¤À¨É¤§.·Q§V¤O¾Ç²ß¤§.

TOP

dim ¬O¥Î¨Ó»s°µ¤W "¥i©ñªF¦èªº¾¹¥×" ºÙ¬°"Åܶq"
AS ¤§«áªº¬°"¾¹¥×"ªºÄÝ©Ê

³o¨Ç¬O©ñ¼Æ¦r(LONG,INTEGER)ªº¾¹¥×
Dim x as long
Dim y as integer
x=1  '§â1©ñ¶iX
y=2  '§â2©ñ¶iY
msgbox(x+y) '³o¥y§âX©MYªº¼Æ­È¥[Á`Åã¥Ü¥X¨Ó

³o¨Ç­Ó¤å¦r(STRING)ªº¾¹¥×
Dim S as STRING
S="ABC"
msgbox(S)'³o¥y§âS¤º®eÅã¥Ü¥X¨Ó


Dim arr(2) ¬O°}¦C
ARR(1)="A"
ARR(2)="B"
MSGBOX(ARR(1) & ARR(2)) '³o¥y§âARR(1)©MARR(2)ªº¤º®e¦X¨ÖÅã¥Ü¥X¨Ó,§Y"AB"
°}¦C³q±`¥Î©ó°j°é

¾ÇExcel VBAªººô¯¸:
http://forum.twbts.com/thread-6621-1-3.html
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¥»©«³Ì«á¥Ñ alumi ©ó 2012-5-30 20:33 ½s¿è

DIM ¬O¥Î©ó«Å§iÅܼƦWºÙ »P Åܼƫ¬ºA
»yªk:
Dim ÅܼƦWºÙ as Åܼƫ¬ºA
½d¨Ò:
Dim I as Integer  ' «Å§i I ¬°¾ã¼Æ«¬ºA, ¨ä­È³Ì¤j»P³Ì¤p½d³ò¬° -32768 ~ 32767

¥ô¦ó¤lµ{¦¡ ¶}ÀY, ¥Î Dim ¶i¦æÅܼƪº«Å§i ¤Î¨Ï¥Î , ¬O¤@­Ó¨}¦nªº¼gµ{¦¡²ßºD.

TOP

ÁÂÁ¤G¦ì¤j¤j,¾Ç²ß¨ì¤F¤@¨Ç«Å§iÅܼƪºÆ[©À¤F.
¦ý¬O long »P integer ¦³¤°»ò®t²§©O?
¥t¥~°Ý¤@¤U,¥i¥H³o¼Ë«Å§i°}¦C¶Ü? Dime arr(x) ÁÙ¬O¥u¯à Dime(1)?
=================================
Dim x as long          ¾ã¼Æ? (­«ÂжÜ)
Dime x as Integer    ¾ã¼Æ? (­«ÂжÜ)
Dim x as string        ¦r¦ê
Dim arr(x)              °}¦C  (¥i¥H³o¼Ë«Å§i°}¦C¶Ü?)
=================================

TOP

Long ¥i¦sÀxªº¼Æ­È ½d³ò, ¤ñ Integer  ¤j¤W³\¦h,
¬Û¹ï¨Ó»¡, ¹Bºâ³t«×¤]¤£¤Î Integer ©Ò«Å§iÅܼƨӪº§Ö.
Integer  2 ­Ó¦ì¤¸²Õ -32,768 ¨ì 32,767
Long (long integer) 4 ­Ó¦ì¤¸²Õ -2,147,483,648 ¨ì 2,147,483,647
--------------------------------------------------------------------
Dimarr(x)   
¥i¥H³o¼Ë¤l«Å§i, ¦ý¤£«Øij.
«Øij«á¤è ¦A©w¸q¨ä¸ê®Æ«¬ºA
¨Ò¦p:
Dim arr(x) as Variant
Dim arr(x) as string
Dim arr(x) as integer

TOP

1.©Ò¥H­Y­n¥[§Öµ{¦¡³t«×, ©Ò¥H«Å§i®É ,­Y¨Ï¥Î¤§Data ¤£·|¶W¹L65536µ§
    «h¥ÎDime x as integer ¸û¨Î.¹ï¶Ü?
2.½Ð°Ý¥H¤U»{ª¾¹ï¶Ü ?
Dim arr(x) as Variant  --> «ü©w¸q°}¦Cxªº¸ê®Æ¬° ?? Variant¬O??
Dim arr(x) as string    --> «ü©w¸q°}¦Cxªº"¤º®e"¬°"¦r¦ê"
Dim arr(x) as integer  --> «ü©w¸q°}¦CXªº"¤º®e"¬°"¼Æ­È"

TOP

1.©Ò¥H­Y­n¥[§Öµ{¦¡³t«×, ©Ò¥H«Å§i®É ,­Y¨Ï¥Î¤§Data ¤£·|¶W¹L65536µ§
    «h¥ÎDime x as integer ¸û¨Î.¹ï¶Ü ...
alex_wu µoªí©ó 2012-5-31 13:26


1. ¹ï. ¦pªG¥u¬O¤Q¼Æ­ÓÅܶq,³o­Ó¦~¥Nªº¹q¸£,³t«×¤À§O¤£·|«Ü¤j

2.
VARIANT ªº·N«ä¬O¥ô·NÃþ«¬, ¥Ñexcel¦Û¤v¥Ñ¤º®e³]©wÃþ«¬
dim abc as variant
abc = 123
³o¼ËabcªºÃþ«¬´N·|Åܦ¨ "variant/integer" §Yinteger

dim abc as variant
abc = "def"
abcªºÃþ«¬´N·|Åܦ¨ "variant/string"

Dim arr(x) as integer
¤£¬O"°}¦Cx", ¦Ó¬O¦³ X+1 ­Ó­Èªº"°}¦CARR"
¨Ò¦p
Dim abc(3) as integer
¸ò³o4¦æÃþ¦ü
Dim abc1 as integer
Dim abc2 as integer
Dim abc3 as integer
Dim abc4 as integer

³]©w¼Æ­È®É:
abc(0)=1
abc(1)=2
abc(2)=3
abc(3)=4
¬Û¹ï©ó
abc1=1
abc2=2
abc3=3
abc4=4
À´±oµo°Ý,µª®×´N·|¦b¨ä¤¤

¤µ¤éの¤@¬íは  ©ú¤éにない
http://kimbalko-chi.blogspot.com
http://kimbalko.blogspot.com

TOP

¶â,ÁÂÁÂ,¹ï«Å§i¦³°ò¦ªº»{ª¾¤F
¥i¬O¬°¤°»ò­n§â¸ê®Æ¥á¨ì°}¦C¸Ì©O?
ª½±µ§âÀx¦s®æ¤ºªº¸ê®Æ¹Bºâ¤£¬O¸û§Ö¶Ü?

¥t¥~°Ý¤@¤U,¾Ç¤F«Å§i(Dim)¤§«á,¤U¤@¶¥¬q»Ý­n¾Ç¤°»ò©O?

TOP

¦^´_ 9# alex_wu
¥i¬O¬°¤°»ò­n§â¸ê®Æ¥á¨ì°}¦C¸Ì©O? ª½±µ§âÀx¦s®æ¤ºªº¸ê®Æ¹Bºâ¤£¬O¸û§Ö¶Ü?
¹Ï1  ¸ê®Æ¦s¦bÀx¦s®æ¤ºªº©Ò¦ûªº¸ê·½
   

¹Ï2  ¸ê®Æ¦s¦b°}¦Cªº©Ò¦ûªº¸ê·½

TOP

        ÀR«ä¦Û¦b : ¥¬¬I¦p¼½ºØ¡A¥HÅw³ß¤ß´þ¼íºØ¤l¡A¤~·|µoªÞ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD