+ Reply to Thread
Results 1 to 6 of 6

One format button to run multiple format buttons on different sheets

  1. #1
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    One format button to run multiple format buttons on different sheets

    hey everyone, I am much better at formulas than I am at VBA so any help you can give me will be much appreciated!

    I have two VBAs each with it's own button on 10 different sheets. so on sheet one i have button one (my first VBA) and button 2 (my second VBA). I would like a master button to run all of the button 1's first then another master button to run all of the button 2's (unless all button 1's can be ran then button 2's with one master button, that would be amazing!)

    I have attached the spreadsheet to this thread. The Overdue Reports Tab has my master buttons with a faulty VBA right now to run all my format buttons. The 10 tabs that end in "-R" will be all of the button 1's and button 2's I talked about above.

    The "-R" tabs have the macros on their tabs but I have included the macros in this thread as well.

    I hope this all makes sense please let me know if you need me to further clarify, Thank you!

    Code for button 1's: (Note: the Set SourceSht/TargetSht are different for each tab)

    Please Login or Register  to view this content.

    Code for button 2's: (Note: the Set r = is different for each sheet)
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by JBeaucaire; 07-25-2016 at 02:20 AM. Reason: Added missing CODE tags. Please read and follow the Forum Rules, link above in the menu bar. Thanks.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: One format button to run multiple format buttons on different sheets

    You could use this code for the first button:
    Please Login or Register  to view this content.
    And this code for the second butto:
    Please Login or Register  to view this content.
    Regards,
    Antonio

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,676

    Re: One format button to run multiple format buttons on different sheets

    Hi there,

    A question:

    The "ifGreenMakeCellValueEQ1" routine needs to be run once for each "-R" worksheet (i.e. ten times), but the "CopyColor" routine seems to involve changes to only the "Mil Pay-R" worksheet - can this routine be run just once?

    Regards,

    Greg M

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,676

    Re: One format button to run multiple format buttons on different sheets

    Hi again,

    Take a look at the attached workbook and see if it does what you need.

    It uses the following code:

    Please Login or Register  to view this content.
    The highlighted values can be changed to suit your own requirements.

    Click on the "Format All Worksheets" button on the "Overdue Reports" worksheet to run the above routines.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-19-2016
    Location
    Colorado
    MS-Off Ver
    Microsoft Office 15
    Posts
    22

    Re: One format button to run multiple format buttons on different sheets

    Greg M, I saw your code and I have no clue how you did it but it is the most beautiful thing I have ever seen! It works perfectly thank you!

    Can you explain the "7" and "D" highlighted fields above so if I adjust them I know what I am adjusting. Thank you again!

  6. #6
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,676

    Re: One format button to run multiple format buttons on different sheets

    Hi again,

    It's feedback like yours that keeps me coming back to this Forum - many thanks

    The "D" value refers to Column D, i.e. the first column in the range to be formatted.

    The "7" value refers to Column 7 (Column G), i.e. the last column in the range to be formatted.



    It wasn't until I read your question that I realised I'd used an inconsistent approach by referring to the first column by its letter and the second column by its number. The attached workbook uses a consistent approach - each of the above columns is referred to by its letter. The "IfGreenMakeCellValueEQ1" routine has been re-written as follows:

    Please Login or Register  to view this content.

    Hope this helps - as before, please let me know how you get on.

    Regards,

    Greg M



    P. S. Please feel free to shout if you need any further explanation of the code.
    Attached Files Attached Files
    Last edited by Greg M; 07-26-2016 at 08:21 AM. Reason: P. S. added

+ 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. Name Range for multiple sheets in the format: 01-4, 01-11, etc.
    By bill@williamcha in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2015, 06:27 PM
  2. Replies: 0
    Last Post: 08-13-2015, 06:23 AM
  3. [SOLVED] Format cells in multiple sheets automatically
    By gokica in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2015, 09:12 AM
  4. Save Multiple Excel Sheets from a Workbook into Multiple Text Macintosh Format VBA
    By ashokpatidar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2013, 10:04 PM
  5. Format duplicate values on multiple sheets
    By dzparker89 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-13-2011, 01:41 PM
  6. How to format multiple sheets at the same time
    By jram in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-27-2009, 08:36 AM
  7. How to bring multiple sheets to tab format?
    By saikumar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-07-2009, 08:06 AM

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