+ Reply to Thread
Results 1 to 7 of 7

Running 3 different macros across selected multiple worksheets in one workbook

  1. #1
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Running 3 different macros across selected multiple worksheets in one workbook

    Hi,
    Hopefully someone will find this easy to solve because it has been very difficult for me.

    I have a spreadsheet with 3 macros that are designed to run on specific worksheets as follows:
    Calibrate - should only run on worksheets beginning from SN to GD (28 worksheets)
    CogCalibrate - should only run on 2 worksheets (WP & NS)
    BIGCalibrate - should only run on 1 worksheet (BIG)

    None of these macros should run on the remaining 5 worksheets (Contents, Instructions, DescriptiveStats, CalibrationSummary, Data).

    To make it easier for other people to use this spreadsheet I have created a Contents page. How can I modify these macros to allow them to be run from buttons on the CONTENTS page? I have looked and tried various examples without success.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Running 3 different macros across selected multiple worksheets in one workbook

    I assume you know how to create buttons. So, make 3 buttons and assign these macros. Hope it's what you want.


    Run Calibrate:
    Please Login or Register  to view this content.
    Run CogCalibrate:
    Please Login or Register  to view this content.
    Run BIGCalibrate:
    Please Login or Register  to view this content.

    Edit: Just noticed you mentioned the 28 worksheets are 'beginning from SN to GD'. You might have to show all those worksheet names, I don't know how they look like. I am only assuming they are all 2 characters long.
    Last edited by millz; 11-12-2013 at 05:34 AM.

  3. #3
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Running 3 different macros across selected multiple worksheets in one workbook

    Excellent. Thanks very much. RunBigCalibrate and RunCogcalibrate work perfectly. Unfortunately the worksheet names for the third macro are of varying lengths. I am writing the macro now and will get back to you once I have finished and tested them. Is there an option to maybe tell this macro to omit sheets instead of telling it to find specified sheets?

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Running 3 different macros across selected multiple worksheets in one workbook

    To 'omit' like you wanted, probably like this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Running 3 different macros across selected multiple worksheets in one workbook

    Fantastic. Works perfectly. One final thing. I wanted to add a message to confirm the macro has run successfully and have modified your macro as below. It seems to work when tested it but I wanted to make sure that this is the right way of doing it.

    Please Login or Register  to view this content.

  6. #6
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Running 3 different macros across selected multiple worksheets in one workbook

    If I assumed correctly that txt_err is a global variable used by your other macros to store the 'processing failed' sheets, then yes it should be working fine.

    You might need to set it to "" first though (if you haven't).

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-10-2009
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Running 3 different macros across selected multiple worksheets in one workbook

    Thanks for all your help with this. very quick and efficient.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hide or Unhide Multiple Worksheets in a selected workbook
    By nchavan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2013, 10:11 AM
  2. Replies: 2
    Last Post: 12-26-2012, 05:02 AM
  3. Running Macros on multiple worksheets
    By shivrklfc in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2012, 11:11 AM
  4. Multiple Users using Shared Workbook and Running Macros
    By Tayque_J_Holmes in forum Excel General
    Replies: 4
    Last Post: 09-06-2012, 12:26 AM
  5. copy selected range from multiple workbooks into multiple worksheets in one workbook
    By novak100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2012, 05:52 AM

Tags for this Thread

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