下記マクロを実行するとyの値が変化しません。
皆さんの環境ではいかがでしょうか。(どこか間違っている?)
バージョン: 6.1.5.2 (x64) Build ID:
90f8dcf33c87b3705e78202e3df5142b201bd805
CPU threads: 4; OS:Windows 10.0; UI
render: GL; ロケール: ja-JP (ja_JP);
Calc: CL
Sub Main
Dim x, y, z As Integer
x = 1: y = 2
Msgbox("x = " & x &" : "& "y = " & y &" : "& "z = " & z)
Get_S(x, y)
Msgbox("x = " & x &" : "& "y = " & y &" : "& "z = " & z)
z = Get_F(x, y)
Msgbox("x = " & x &" : "& "y = " & y &" : "& "z = " & z)
End Sub
Sub Get_S(ByVal a As Integer, ByRef b As Integer)
a = -3: b = -2
End Sub
Function Get_F(ByVal a As Integer, ByRef b As Integer) As Integer
Dim c As Integer
c = a + b
a = -3: b = -2
Get_F = c
End Function