lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
I need you help understanding how to pass an argument to a sub. In this article the author said
"VBA procedures can be passed data via arguments, which are declared in the procedure definition. For example, you could have a VBA Sub procedure that adds an Integer to every cell in the current selected range on a worksheet. You could supply the value of the integer to the Sub via an argument, as follows:"
my question, how can I pass an argument to a sub. I mean lets talk about the example above. I highlight these cells that I want to add an integer to. I insert a control button and assign it to that Macro. Now I click the button to run the macro. How and when I can pass the argument?
Thank you very much.
source: VBA Function and Sub Procedures
I need you help understanding how to pass an argument to a sub. In this article the author said
"VBA procedures can be passed data via arguments, which are declared in the procedure definition. For example, you could have a VBA Sub procedure that adds an Integer to every cell in the current selected range on a worksheet. You could supply the value of the integer to the Sub via an argument, as follows:"
my question, how can I pass an argument to a sub. I mean lets talk about the example above. I highlight these cells that I want to add an integer to. I insert a control button and assign it to that Macro. Now I click the button to run the macro. How and when I can pass the argument?
Thank you very much.
source: VBA Function and Sub Procedures