+ Reply to Thread
Results 1 to 8 of 8

selecting modules

  1. #1
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    selecting modules

    I need to be able to activate modules by entering a site name into an inputbox. the subs in the modules are called the same.

    This is the approach I have been trying not sure if it is the right approach though.

    Please Login or Register  to view this content.
    can somebody help please?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Activate a module? You mean run a subroutine by name?

    BTW, there's no need for you use to use the Application.InputBox method versus just the plain InputBox function for what you're doing.

  3. #3
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    I'm not sure

    I'm not sure,
    What I have is 2 modules with the basically the same code in them, each module is for a different site. I have a different worksheet for each site with the data in them, I now need to be able to have a 3rd sheet which when a command button is clicked a message box will ask for the site name, I was hoping to use the site name to activate the a sub in the module with the site name

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You could have one subroutine that accepts the site name as an argument and behaves appropriately. I can't make a more specific suggestion without seeing your code and understanding your intent.

  5. #5
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    Attached sample file

    I have attached a file with how the workbook is set up.

    sheet1 is attached to module 1 and sheet 2 is attached to module2, At the monent I have the control buttons on each sheet but I need to be able to do away with the control buttons on each sheet and only have them on the summary sheet, but be able to activate each module from the two command buttons on the summary sheet by entering which module (1 or 2) is desired into an inputbox
    Attached Files Attached Files

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430
    You only included the routine stubs in your example so we can not see how alike the update or graph routines are.

    If the routines are really very different then why not simply call them update1, update2, graph1 and graph2
    Cheers
    Andy
    www.andypope.info

  7. #7
    Registered User
    Join Date
    06-27-2008
    Location
    brisbane
    Posts
    23

    The routines use the data in the sheet that they are on

    The routines are pretty much the same, the update and graph routines at the moment use the data that is in the sheet that they are on, so the only difference is the sheet that the code refers to.
    I'm not sure on the approach or the code to use?

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,430
    If the only difference is the sheet then maybe you can modify your code to use the Activesheet object?

    Otherwise you could pass the sheet into the routines as an argument.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    The same graph routine can be used from any sheet, just change button event code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1