+ Reply to Thread
Results 1 to 5 of 5

how to run macro for all sheets in a workbook

  1. #1
    Registered User
    Join Date
    05-17-2011
    Location
    Kazan', Russia
    MS-Off Ver
    Excel 2010
    Posts
    6

    how to run macro for all sheets in a workbook

    Hi guys;

    I have a macro embedded in a sheet with a control form button. it works well for that sheet. I want to use it for other same sheets in that workbook. How should I configure my macro so that it runs for all same sheets in workbook in one push ? I want to run the macro only in first sheet and it must solve all the similar sheets.

    I use excel 2010, it is easy to make new tabs in this version. Maybe it is good idea to create a new tab with this macro and make it possible to run for whole workbook ?

    p.s. I have found some codes in internet to run a macro in several sheets in a workbook. I embedded my code in their algoritm, but none of them works. They only solve the first sheet, no effect on other sheets

    thanks for answers.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: how to run macro for all sheets in a workbook

    Can you post your code so we can see what it's doing?

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Registered User
    Join Date
    05-17-2011
    Location
    Kazan', Russia
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: how to run macro for all sheets in a workbook

    Please Login or Register  to view this content.

  4. #4
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: how to run macro for all sheets in a workbook

    I'm not too hot on coding Solver as I rarely use it but you could try activating each worksheet before running the solver code otherwise it'll just run loads of times on the worksheet you've got active I think.

    Please Login or Register  to view this content.

    Probably not the best approach but worth a try.

    Dom

  5. #5
    Registered User
    Join Date
    05-17-2011
    Location
    Kazan', Russia
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: how to run macro for all sheets in a workbook

    Yes, Domski you are right,
    it works now.
    Thank you a lot for solving my problem.

+ 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