+ Reply to Thread
Results 1 to 9 of 9

Option to run all Case statements

  1. #1
    Registered User
    Join Date
    03-04-2013
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    14

    Option to run all Case statements

    Short background:
    I have 11 shape buttons, each with a unique name, and designed to run a different report. 1 of the 11 buttons is a "Run all Reports". I have 1 case statement that will recognize the name of the button selected and run that Case.

    My question:
    Is there anyway for when the "Run all Reports" button is selected I can have it run through the other 10 Case statements?

    Below is the part of the code I have so far.

    Thanks.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by wjwelch1; 03-17-2017 at 11:53 AM. Reason: Post edited to add runReport() code.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Option to run all Case statements

    Hi,

    What does the code for runReport look like?
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Registered User
    Join Date
    03-04-2013
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Option to run all Case statements

    Quote Originally Posted by xlnitwit View Post
    Hi,

    What does the code for runReport look like?
    xlnitwit, I have edited my post to include the runReport code.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Option to run all Case statements

    I'm afraid that doesn't actually help that much as it basically just calls a couple of other routines.

    What I really want to know is whether the code would effectively need to populate rgValues with each item in turn, or is there a single value it can use for ALL_REPORTS?

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Option to run all Case statements

    You can't have it run through multiple case statements. Each case is like an OR operator. You could, of course, code it differently. Maybe something like this (the code is not tested)...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  6. #6
    Registered User
    Join Date
    03-04-2013
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Option to run all Case statements

    Unfortunately, my workbook is over 2MB so I can't just upload it so you can see it.

    To answer your question "is there a single value it can use for ALL_REPORTS" I going to have to say no. More info about the report is each button creates a new workbook and names the workbook to the set rgValue.

  7. #7
    Registered User
    Join Date
    03-04-2013
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Option to run all Case statements

    Quote Originally Posted by AlphaFrog View Post
    You can't have it run through multiple case statements. Each case is like an OR operator. You could, of course, code it differently. Maybe something like this (the code is not tested)...
    AlphaFrog, I am testing your suggested code now. So far so good. I usually takes about 5 minutes to run through all reports. I will let you know after it's all done if it works for me or not.

  8. #8
    Registered User
    Join Date
    03-04-2013
    Location
    Fort Worth, Texas
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Option to run all Case statements

    AlphaFrog, your loop worked the only issue is the line ActiveSheet.Shapes(CallingShapeName).Delete is not actually deleting the shapes. But over all you solved my question.

    Thanks.

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Option to run all Case statements

    Quote Originally Posted by wjwelch1 View Post
    AlphaFrog, your loop worked the only issue is the line ActiveSheet.Shapes(CallingShapeName).Delete is not actually deleting the shapes. But over all you solved my question.

    Thanks.

    You're welcome.

    Remove CallingShapeName from the Dim statement and it should work.

    Please Login or Register  to view this content.

+ 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. [SOLVED] Case Select Statement the best option?
    By skellz022782 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-19-2016, 03:05 PM
  2. VBA Case statements
    By Gurureddevils in forum Excel General
    Replies: 1
    Last Post: 07-19-2015, 02:44 AM
  3. [SOLVED] Case Statements and If Statements
    By hawsoon13 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-05-2012, 12:44 PM
  4. Multiple case statements
    By abhijit.pendharkar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-28-2009, 04:12 AM
  5. Case Statements
    By anazarian in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-08-2008, 06:11 AM
  6. Select Case Statements
    By ladeda063610 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-06-2008, 11:25 AM
  7. Option Groups and Select Case
    By Nubby in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-21-2006, 10:25 PM

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