这里怎么和 ByRef 一样
Private Sub Command1_Click()Dim a As Long, m As Long
m = 100
a = 10
mysub1 m, 3 '有参数
mysub1 a '没有参数
End Sub
Private Sub mysub1(ByVal n As Long, Optional val) '这里怎么把 ByVal n As Long 改成 ByRef n As Long 效果一样?
n = n + 9
Dim s As String
If IsMissing(val) Then
s = "not pass 没有参数"
Else
s = "ok 有参数"
End If
MsgBox n & "," & s
End Sub