+ Reply to Thread
Results 1 to 8 of 8

GoTo or Run Code???

  1. #1
    Registered User
    Join Date
    04-09-2008
    Posts
    5

    GoTo or Run Code???

    What I am needing is a way to jump from one section of the module to another section. It runs a validation step first then once completed I need it to run the email portion of the code. I have colored "RED" the two sections I need it to go from and to. Any help on this would be appreciated I have searched all over the forum and the net trying to find a way to make this work. This module runs when one button is pushed. Unless theres a way to assign two modules to a button in excel

    Thanks
    Jennifer

    Please Login or Register  to view this content.
    Last edited by jkauffman; 04-09-2008 at 05:27 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    Please edit your post to add code tags:

    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code]

  3. #3
    Registered User
    Join Date
    04-09-2008
    Posts
    5
    Hello,

    Was checking back to see if anyone had any ideas on this code for me.

    Thanks
    Jennifer

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    To call another macro from the 1st macro is easy

    Please Login or Register  to view this content.
    Macro1 starts to run, calls macro2
    after MAcro2 runs macro1 continues running from the next command after it called macro2

    Note you do not need to use the word Call in front of the macro name
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Registered User
    Join Date
    04-09-2008
    Posts
    5
    Thanks I see how that works but here is the code where I want to call the other Macro. I can call both my macros from another macro by themselves no problem. But for some reason it wont call the macro I have highlighted when I put the code in like this. Any thoughts???

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor Rick_Stanich's Avatar
    Join Date
    11-21-2005
    Location
    Ladson SC
    MS-Off Ver
    Office365
    Posts
    1,177
    My first guess would be a requirement is not being met? In this section of your code you use the same "If" statement twice.
    Please Login or Register  to view this content.
    I would think that the string "If Range(requiredCells(i)).Value" is not evaluating to "vbNullString".

    A second look I see that you reset your "If" satement to "If Range(requiredCells(i)).Value = userInput(prompts(i))", then the second "If" statement would not evaluate to "vbNullString" and the call statement would be ignored.
    Last edited by Rick_Stanich; 04-23-2008 at 10:10 AM.
    Regards

    Rick
    Win10, Office 365

  7. #7
    Registered User
    Join Date
    04-09-2008
    Posts
    5
    I see what your saying this is how the code was originally written, I don't write very much VB code but have an understanding of how it works. It is set to exit the sub once it's finished checking all the cells for data. But what I need it to do is call the Email Macro so the excel file is then emailed out, that is where I am having the problem. I can't get it to go from this macro once its done with its routine to the email macro

    Thanks

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    04-09-2008
    Posts
    5
    Wooo hooo never mind my brain just exploded, I took out the second If statement and put in an else statement and NOW it works

    Thanks for everyones help on this, sometimes it helps to have a few extra eyes and brain cells

+ 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