10 modules using 5 private subs

  • i have 10 different modules in a project. modules all use the same 5 private sub's .


    is it possible to place the 5 x private subs in 1 module and call from the main mudules the priuvate subs.


    if so how can tyhis be achieved
    module A, B, C, D, E, ...... ,J
    private sub1, 2, 3, 4, 5

  • Yes you can if you use the Run command and the name of the private sub as a string. For eaxample the following simple macro in one module executes a private macro in another module.

    Code
    Sub Atest()
        Run "PrivateOne"
    End Sub
  • i might have misled you, all the modules which work at different times all use the sam private subs. ie
    module A
    private sub1, 2, 3, 4, 5


    module B
    private sub1, 2, 3, 4, 5
    ectra.
    or i have read your email incorrectly

  • I think you misread my answer (or more likely I miswrote it) The private subs can all be in one module, it doesn't matter which one. They can then be called from any other module in the workbook using the Run command and the name of the private sub in quotes. Try it.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!