Really it's only to keep everything nice and tidy, so that when another user
has to use the workbook and run a macro there is less chance of the wrong
this being run. I can easily keep the macros within the same module, but
this is a little cumbersome when updating code.
You could put a dummy parameter in the sub you would rather keep private:
Public Sub test(ByVal dummy As String)
MsgBox "Hello"
End Sub
This won't then be visible to anyone wanting to run a macro from outside the
VBE window, and if you want to call it from another macro you can pass a
dummy parameter:
Why not make the variable Optional... the Sub will still not appear in the
Macro listing and the OP will not have to pass it anything in order to use
it...
Public Sub TestMe(Optional Dummy As String)
MsgBox "Hello"
End Sub
And then your Demo subroutine can call it like this...
Sub Demo()
Call TestMe
End Sub
or, more simply, like this...
Sub Demo()
TestMe
End Sub
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.