+ Reply to Thread
Results 1 to 17 of 17

event procedure

  1. #1
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    event procedure

    Hi everyone,

    I am looking for an event procedure that will enable me, with a click of a button on Sheet1, to call Private subs from Sheet1, Sheet2, etc.

    Something like this:

    Please Login or Register  to view this content.
    Program1 is on sheet1
    Program2 is on sheet2

    Best regards
    Last edited by Matija; 02-23-2011 at 07:43 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: event procedure

    Put the macros into a standard module, not the sheet module & remove private
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    would then I be able to solve my problem?

  4. #4
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    hi, royUK i did how you instructed me to do, but i still have to press a button on each sheet that i want the macro to run.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: event procedure

    Your original question said that you wanted to run the code from a button.

  6. #6
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    my question is how to run a makro, now in a standard module, on multiple sheets, despite it is started by button click on one sheet.
    Last edited by Matija; 02-23-2011 at 04:41 AM.

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: event procedure

    Do you mean to run it on each sheet at once?

  8. #8
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    at once or can I say miliseconds apart

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: event procedure

    The only way would be to loop through each sheet. Time taken will depend on th code.

    Attach the workbook

  10. #10
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    here it is. I deleted something, but there is still everything needed. I want to run those two macros in standars modules in both sheets at once.
    Attached Files Attached Files

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: event procedure

    As I said the time taken will depend on the efficiency of the code, Your code requires selecting the sheets because you use Active Cell. This will slow the code down and could probably be avoided, as could the loops in the code.

    You need something like this
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    it is the same as before the program runs in active sheet where the button is. did that work for you to run macro in both sheets?

  13. #13
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    sorry didn't post it under the right button i will try again

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: event procedure

    I didn't run the code, I know if a loop will work

  15. #15
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    it works, you helped alot.

    Best regards

  16. #16
    Registered User
    Join Date
    02-01-2011
    Location
    Slovenia
    MS-Off Ver
    Excel 2003
    Posts
    44

    Re: event procedure

    i rated you if that helps you. What did you mean by that i could had avoided those loops. Is there some other way.

    Best regards

  17. #17
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: event procedure

    Your actual macros have loops which could probably be avoided, but I haven't time to check it out at the moment

+ 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