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

[µo°Ý] ¦Û©w¸q¨ç¼Æ¦p¦ó½á­Èµ¹Àx¦s®æ

[µo°Ý] ¦Û©w¸q¨ç¼Æ¦p¦ó½á­Èµ¹Àx¦s®æ

¦Û©w¸q¨ç¼Æ¤º¦p¦ó½á­Èµ¹Àx¦s®æ,·P®¦.

¦Û©w¨ç¼Æ½á­È.rar (13.23 KB)

§ù¤p¥­

¦^´_ 1# dou10801


    ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾Ç¬ã²ß¦Û­q¨ç¼Æ,´ú¸Õ¤è®×¦p¤U,«e½ú°Ñ¦Ò

Àx¦s®æ¨ç¼Æ³]©w:


VBA:
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 2# Andy2483 ½Ð±Ð«e½ú,¬O§_¯à±Nresult[°Ñ¼Æ],¶Ç¨ì[A1]Àx¦s®æ,ÁÂÁÂ.
§ù¤p¥­

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-5-23 16:37 ½s¿è

¦^´_ 3# dou10801


    ÁÂÁ«e½ú¦^´_
¦Û­q¨ç¼Æ¦n¹³¥u·|µ¹¦Û¤v­È,«á¾Ç¤]¬Oªì¾Ç,«e½ú½Ð°Ñ¦Ò¥H¤UªºÀ³¥Î,¬Ý¬Ý¾A¤£¾A¦X

¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 4# Andy2483

c1¤½¦¡,d1Åã¥Ü

   

Function test(a As Integer, b As Integer)
    Evaluate "test1(" & Application.Caller.Offset(0, 1).Address(0, 0) & "," & a & "," & b & ")"
    test = ""
End Function


Sub test1(c As Range, a As Integer, b As Integer)
    c = a + b
End Sub

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-5-24 08:23 ½s¿è

¦^´_ 5# quickfixer
¦^´_ 3# dou10801

ÁÂÁ¤G¦ì«e½ú
«á¾ÇÂǦ¹©«¾Ç²ß¨ì«Ü¦hª¾ÃÑ,ÃjÃjÀ´À´¾Ç²ß¤ß±o¦p¤U,½Ð«e½ú¦A«ü¾É




Option Explicit
Function MyCustomFunction(ByVal arg1 As Integer, ByVal arg2 As Integer) As String
'¡ô¦Û­q¨ç¼Æ:MyCustomFunction(«Å§iarg1¬O ªø¾ã¼Æ ,«Å§iarg2¬O ªø¾ã¼Æ)
'¡ô¦]¬°[B2]¥»¨­¦Û­q¨ç¼Æ®æ ¹Lµ{µ¹[A1]­È,¦Ó[B2]³Ì²×­È¬OªÅ¥Õ,©Ò¥H¤£¯à¬OAs Integer
'¥i¥H§R±¼ As IntegerÅܦ¨³q¥Î«¬ÅܼÆ,©Î´««Å§i¬O As String

Evaluate "test1(" & Application.Caller.Offset(-1, -1).Address(0, 0) & "," & arg1 & "," & arg2 & ")"
'¡ô¦^¶ÇEvaluate "~~~" ­È
'arg1Åܼƶǻ¼µ¹ aÅܼÆ
'arg2Åܼƶǻ¼µ¹ bÅܼÆ

MyCustomFunction = ""
'¡ô¥O³o¦Û­q¨ç¼Æµ²ªG¬OªÅ¥Õ
End Function

Function test1(c As Range, a As Integer, b As Integer)
c = a + b
'¡ôa + b­pºâµ²ªG¶Ç»¼µ¹cÅܼÆ(Àx¦s®æ)
End Function

Sub Àx¦s®æ¦ì§}()
MsgBox [A1].Address(0, 0)
MsgBox [A1].Address(1, 0)
MsgBox [A1].Address(0, 1)
MsgBox [A1].Address(1, 1)
End Sub
===============================================
¥H¤U¬O¾Ç²ßºô­¶
https://learn.microsoft.com/zh-t ... pplication.Evaluate
https://learn.microsoft.com/zh-t ... .application.Caller
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-5-24 11:28 ½s¿è

¦^´_ 6# Andy2483


    §ó¥¿:
Function MyCustomFunction(ByVal arg1 As Integer, ByVal arg2 As Integer) As String
'¡ô¦Û­q¨ç¼Æ:MyCustomFunction(«Å§iarg1¬O µu¾ã¼Æ ,«Å§iarg2¬O µu¾ã¼Æ)µ²ªG­È¬O¦r¦ê

% -integer(¾ã¼Æ¸ê®ÆÃþ«¬_-32,768 ¨ì 32,767)
& -long(ªø¾ã¼Æ_-2,147,483,648 ¨ì 2,147,483,647)
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ dou10801 ©ó 2023-5-24 11:43 ½s¿è

¦^´_ 6# Andy2483 ·PÁÂ:quickfixer,Andy2483 ¨â¦ì«e½ú«üÂI,¦pªG,­n¶Ç»¼µ¹[A1]ªº¬O¤@­Ó¦r¦ê,­n¦p¦ó³B²z,·P®¦.
§ù¤p¥­

TOP

¦^´_ 8# dou10801


    ÁÂÁ«e½ú¦^´_
«á¾Ç±Nµ²ªGÅܤƦp¤U,½Ð°Ñ¦Ò

°õ¦æµ²ªG:



Function test1(c As Range, a As Integer, b As Integer)
c = "'" & a & b
End Function
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 9# Andy2483
«D±`·PÁ¦^ÂÐ,¸ÕµÛ¥Î¦r¦ê,MyCustomFunction("¤ôªG","½­µæ"),¦p¦ó³B²z,ÁÂÁÂ.
Option Explicit
Function MyCustomFunction(ByVal arg1 As String, ByVal arg2 As String) As String
Evaluate "test1(" & Application.Caller.Offset(-1, -1).Address(0, 0) & "," & arg1 & "," & arg2 & ")"
MyCustomFunction = ""
End Function

Function test1(c As Range, a As Range, b As Range)
c = "'" & a & b
End Function
§ù¤p¥­

TOP

        ÀR«ä¦Û¦b : °ß¨ä´L­«¦Û¤vªº¤H¡A¤~§ó«i©óÁY¤p¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD