ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with private sub (https://www.excelbanter.com/excel-programming/278760-problem-private-sub.html)

Conrado Capistrano

Problem with private sub
 
Hello NG,

I use private sub so that my code will not be run via Tools|Macro|Macros.
However, it seems that a private sub can only be called by a procedure
within the same module. My problem is that I have a several userforms that
also need to call those private sub. e.g a command button that will do some
validation then call the procedures.

Pleas help!

TIA

Jon-jon



Neil[_11_]

Problem with private sub
 
Conrado

sub whatEver (Optional x as integer)
'your code here
end sub

Will not display in Tools|macros but can be called by other modules.


Neil

"Conrado Capistrano" wrote in message
...
Hello NG,

I use private sub so that my code will not be run via Tools|Macro|Macros.
However, it seems that a private sub can only be called by a procedure
within the same module. My problem is that I have a several userforms

that
also need to call those private sub. e.g a command button that will do

some
validation then call the procedures.

Pleas help!

TIA

Jon-jon





Conrado Capistrano

Problem with private sub
 
Neil,

That was great. thanks,

Jon-jon

"Neil" wrote in message
...
Conrado

sub whatEver (Optional x as integer)
'your code here
end sub

Will not display in Tools|macros but can be called by other modules.


Neil

"Conrado Capistrano" wrote in message
...
Hello NG,

I use private sub so that my code will not be run via

Tools|Macro|Macros.
However, it seems that a private sub can only be called by a procedure
within the same module. My problem is that I have a several userforms

that
also need to call those private sub. e.g a command button that will do

some
validation then call the procedures.

Pleas help!

TIA

Jon-jon








All times are GMT +1. The time now is 09:52 PM.

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