+ Reply to Thread
Results 1 to 4 of 4

How to trigger actions for three choices in a macro

  1. #1
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,979

    How to trigger actions for three choices in a macro

    I have a series of macros altering various workbooks and sheets. They're numbered Step1, Step2, etc. In my Step5 I have a series of Case statements in a macro, and I don't know how to get it to do what I want next. I have NOT tried running this code yet, and I'm sure I have something(s) wrong in it, so would appreciate all the help I can get. I'll post the pertinent section of my (poor) code below, but let me summarize first what I want to do:

    1) If the selection in DstWbk, sheet "Steps", is "01DSP" through "11DSP" the macro needs to delete specific columns in the SrcWbk, and then move to the next step (6).

    2) If the selection in DstWbk, sheet "Steps", is "*DSP" the macro needs to go directly to the next step (6)

    3) If the selection in DstWbk, sheet "Steps", is anything else the macro needs to flash a generic "No Data found" message and move on to Step7.

    The part of the code that's throwing me begins at 'Select only the specific regional data' and ends at the "Case Else MsgBox"

    Please Login or Register  to view this content.
    Last edited by jomili; 12-30-2009 at 01:13 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Three Choices

    Here's a modest clean-up of your code. No one is likely to be able to provide substantive assistance without seeing the workbook.
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

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

    Re: Three Choices

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Hope that helps.

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

    Free DataBaseForm example

  4. #4
    Valued Forum Contributor
    Join Date
    12-02-2009
    Location
    Austin, Tx
    MS-Off Ver
    Office 365 64-Bit, 2108, build 14326.21018
    Posts
    3,979

    Re: Three Choices

    Shg,

    Thanks for your cleanup of my code. I'm just learning this stuff so am making plenty of mistakes. However, I think I know how to solve my problem. The confusion for me was how I was to get to the next action, and I was only thinking of drilling down in the same macro. But then I realized, I could write separate macros for each choice, so just add "Run ThisMacro" for one choice, "Run ThatMacro" for another choice, and "Run NotherMacro" for the third choice, and end the sub that started it. Your cleanup will help me to do that effeciently.

    Thanks for your help!

+ 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