+ Reply to Thread
Results 1 to 6 of 6

Run Macro In Specific Sheet Range

  1. #1
    Registered User
    Join Date
    07-31-2012
    Location
    Buffalo, United States
    MS-Off Ver
    MS Office 2007, 2010, 2013
    Posts
    59

    Run Macro In Specific Sheet Range

    I have my template workbook with sheet tab as following:

    \Summary/\Report/\Contact 1/\Contact 2/\Contact 3/\Contact 4/\Contact 5/\Note/

    And I have one macro to run and only want to run in the specific sheet as below:

    \Summary/\Report/\Contact 1/\Contact 2/\Contact 3/\Contact 4/\Contact 5/\Note/

    The sheet name for contact 1 to 5 is varies means it can be change to any name based on different job. How should I write my macro in order to do that with one macro?
    Last edited by jackgan; 06-17-2014 at 11:37 AM.

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Run Macro In Specific Sheet Range

    Please Login or Register  to view this content.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    07-31-2012
    Location
    Buffalo, United States
    MS-Off Ver
    MS Office 2007, 2010, 2013
    Posts
    59

    Re: Run Macro In Specific Sheet Range

    Never thought about that approach but how do I call my macro with that?

  4. #4
    Registered User
    Join Date
    07-31-2012
    Location
    Buffalo, United States
    MS-Off Ver
    MS Office 2007, 2010, 2013
    Posts
    59

    Re: Run Macro In Specific Sheet Range

    I have my code as follow:

    Please Login or Register  to view this content.
    How should I modify my code so that when the macro end it will return to where I start my macro?
    Last edited by jackgan; 06-17-2014 at 11:39 AM.

  5. #5
    Registered User
    Join Date
    07-31-2012
    Location
    Buffalo, United States
    MS-Off Ver
    MS Office 2007, 2010, 2013
    Posts
    59

    Re: Run Macro In Specific Sheet Range

    I finally figure it out from other forum and below is my quote.

    Please Login or Register  to view this content.
    Reference:
    http://www.excelforum.com/excel-form...ter-macro.html
    http://www.mrexcel.com/forum/excel-q...ific-ones.html
    http://www.mrexcel.com/forum/excel-q...pt-sheet1.html
    Last edited by jackgan; 06-17-2014 at 11:39 AM.

  6. #6
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Run Macro In Specific Sheet Range

    Yeah sometimes instead of trying to identify what TO do work to it can be easier to pick what to NOT do work to.

    I would suggest you declare the 2 sheets as strings then define them and call them with the variable instead. It just makes it more tidy and easier to change in the future instead of looking for all the places you have something hardcoded like that.[Obviously you can change the variable names to whatever makes the most intuitive sense to you]

    Please Login or Register  to view this content.
    I am glad you figured it out. If it is solved go ahead and mark it solved and if you have any other questions just post up on the forum.

+ 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] Copy a specific range to another sheet adding all the workdays for a specific time period
    By MariaPap in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-05-2014, 02:19 AM
  2. Copy and paste specific range to date specific range in alternate sheet
    By alanalmarza in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-21-2013, 08:29 AM
  3. [SOLVED] Macro to copy a specific range from a hidden sheet
    By dumblonde in forum Excel General
    Replies: 7
    Last Post: 05-10-2012, 02:50 AM
  4. [SOLVED] How to get (range)macro to always run code on a specific sheet regardless of active sheet?
    By JTwrk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2012, 04:33 PM
  5. Non-Sheet Specific Macro to copy range of cells to next worksheet in WB
    By Petrolcb41 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-29-2010, 11:04 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