ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   optional parameter (https://www.excelbanter.com/excel-programming/359460-re-optional-parameter.html)

Ben

optional parameter
 
Thanks Tom.

--



"Jim Thomlinson" wrote:

You bet...

Sub test(Optional ByVal Stuff As Integer = 100)
MsgBox Stuff
End Sub

Sub TryIt()
Call test
Call test(50)
End Sub

Note when you call the sub the optional argument shows up in square
brackets. Also optional arguments must show up at the end of the argument
list.
--
HTH...

Jim Thomlinson


"Ben" wrote:

Hi all,

If there's a Optional parameter in the Sub:

Sub test( option....)
...
...
end sub

is the parameter pass by ref or by val in the optional paramater? Thanks.

Ben


--


Jim Thomlinson

optional parameter
 
That must have been a good answer. You think I'm Tom. I'm flattered...
--
HTH...

Jim Thomlinson


"Ben" wrote:

Thanks Tom.

--



"Jim Thomlinson" wrote:

You bet...

Sub test(Optional ByVal Stuff As Integer = 100)
MsgBox Stuff
End Sub

Sub TryIt()
Call test
Call test(50)
End Sub

Note when you call the sub the optional argument shows up in square
brackets. Also optional arguments must show up at the end of the argument
list.
--
HTH...

Jim Thomlinson


"Ben" wrote:

Hi all,

If there's a Optional parameter in the Sub:

Sub test( option....)
...
...
end sub

is the parameter pass by ref or by val in the optional paramater? Thanks.

Ben


--



All times are GMT +1. The time now is 05:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com