+ Reply to Thread
Results 1 to 3 of 3

I can't figure out how to use code for two separate macros

  1. #1
    Forum Contributor
    Join Date
    02-14-2014
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2013
    Posts
    328

    I can't figure out how to use code for two separate macros

    I have a fairly extensive VBA code (75+ lines) that I would like to use in two different situations.

    The code for the second situation would be the same as the first except for a few additional lines of code.

    The first code uses a macro key combination (Ctrl-Shft-s) to call it.
    I would like to call the second code with its own macro key combination ((Ctrl-Shft-u).

    Ideally I would like to use the first macro's code and then jump to a second section to deal with the second situation.

    So here's the problem.
    How can I use the Ctrl-Shft-u to run the second macro, when I want to run the first code and then jump?

    Of course I know I can just copy all of the first code into the second macro, but I'm looking for a more efficient way to do this.

    TIA
    Last edited by ChrisXcel; 07-24-2014 at 09:59 PM. Reason: Fixed the title

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Trying to use code for two macros

    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 go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,450

    Re: Trying to use code for two macros

    Sort out your thread title and then we can help you
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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] Vb macros code for sorting:
    By Dharani Suresh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-14-2013, 02:29 AM
  2. [SOLVED] Run 3 macros with VB Code
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-24-2013, 01:40 PM
  3. Importing Excel Macros Code from another Excel sheet which has Macro code.
    By arun.pillai in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2010, 05:38 PM
  4. Disable Macros From Within VBA Code?
    By Eric S. in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-04-2007, 10:36 AM
  5. [SOLVED] macros or code
    By Neal in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2005, 02:05 PM

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