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

[µo°Ý] ByVal Target As Range ¥Îªk

Sub °õ¦æ§Ú()
  '¥Î ByRef µo¥Í ¥»´L«H®§ ³Q ¾F©~2 «§ï¨Æ¥ó
  '¾É­P ¾F©~3, ¾F©~4 ¦¬¨ì¿ù»~«H®§
  '§ï¦¨ ByVal ´N¥i¥HÁ׶}³Q ¾F©~2 «§ï
  
   msg = "§Ú¬O³¯¤p¬ü, ¬P´Á¤é±ß¤W6:00 Åwªï¨Ó§Ú®a»EÀ\"
   µo«H®§µ¹¾F©~1 msg
   µo«H®§µ¹¾F©~2 msg
   µo«H®§µ¹¾F©~3 msg
   µo«H®§µ¹¾F©~4 msg
End Sub


Sub µo«H®§µ¹¾F©~1(ByRef msg)
    MsgBox "¾F©~ 1 ¦¬¨ì«H®§: " + msg
End Sub
Sub µo«H®§µ¹¾F©~2(ByRef msg)
    MsgBox "¾F©~ 2 ¦¬¨ì«H®§: " + msg
   
    msg = "§Ú¬O³¯¤p¬ü, ¬P´Á¤é±ß¤W»EÀ\¦]¬°¦³¨Æºò«æ¨ú®ø"            '¾F©~2 ´c·d«H®§
End Sub
Sub µo«H®§µ¹¾F©~3(ByRef msg)
    MsgBox "¾F©~ 3 ¦¬¨ì«H®§: " + msg
End Sub
Sub µo«H®§µ¹¾F©~4(ByRef msg)
    MsgBox "¾F©~ 4 ¦¬¨ì«H®§: " + msg
End Sub

TOP

cc lai ¤j¤j, jackyq  ¤j¤j

¦Ó®a§Ú¯uªº©ú¥Õbyvalªº¥Îªk,¯uªº¦hÁ§A­Ì¤£¹½¨ä·ÐÀ°¦£¸ÑÄÀ©M´£¨Ñ¦C¤lµ¹§Ú°Ñ¦Ò
¸U¤À·PÁ§A­ÌªºÀ°¦£....
ÁÂÁÂ

TOP

¦^´_ 12# mdr0465


¸É¥R
1. ¨S«Å§i®É¬° ByRef
2. ¥Î()¬A¦í¤Þ¼Æ®É¡A±j­¢¶Ç­È¡C

Sub ¥Dµ{¦¡()
    Dim A%, B%, C%
    Debug.Print
        
    A = 123: B = 456: C = 789
    Debug.Print "¥Dµ{¦¡", A, B, C
   
    Call °Æµ{¦¡((A), (B), C) '(A)¡B(B)±j­¢¶Ç­È
    Debug.Print "°Æµ{¦¡ - 1", A, B, C
   
    Call °Æµ{¦¡(A, B, C)
    Debug.Print "°Æµ{¦¡ - 2", A, B, C
End Sub

Sub °Æµ{¦¡(X%, ByRef Y%, ByVal Z%) '¨S¦³«Å§i®É¤º©w¬°ByRef
    X = 321: Y = 654: Z = 987
End Sub

'Debug.Print
'¥Dµ{¦¡         123           456           789
'°Æµ{¦¡ - 1     123           456           789
'°Æµ{¦¡ - 2     321           654           789
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

about byval  2,3.....
(2) ¦ÛÂ૬ºA
(3)  ¦Ü©óª«¥ó
       ª«¥ó¤£»Ý­n¤À¨­ (  ª«¥ó¦Û¤v·|³B²z  )
       ª«¥ó¤]¤£¾A¦X¦³¤À¨­ (  ®Ä¯à§é¦©  )
so  byval object ½sĶ¾¹¶ÇªºÁÙ¬O¥»´L

TOP

¯uªº¸U¤À¦hÁÂML089ª©¥D,JACKQ ¤j¤j,¤£¹½¨ä·Ð¹ï·MÄøªº¤p§Ìµ¹¤©¸Ô²Óªº¸ÑÄÀ...
§Ú²{¦b§ó¥[©ú¥Õ¨ìbyval ªº»yªk¥Î³~,
ÁÂÁ¨â¦ì.......

TOP

        ÀR«ä¦Û¦b : ¤H¨ÆªºÁ}Ãø»PµZ¿i¡A´N¬O¤@ºØ¦ÒÅç¡C
ªð¦^¦Cªí ¤W¤@¥DÃD