+ Reply to Thread
Results 1 to 2 of 2

How do you use the sheet code name in a macro

  1. #1
    Registered User
    Join Date
    05-20-2015
    Location
    Indiana, United States
    MS-Off Ver
    2007
    Posts
    4

    How do you use the sheet code name in a macro

    Hello.

    I recorded a macro that is currently saved in my Personal workbook. I need the macro to run on any of the data spreadsheets I open so the first worksheet will already be named. This causes me to initially have a 'Sheet1' codename for the first worksheet and a 'Sheet1' name for the second worksheet until I change the second sheet name later in the macro. I need the macro to to use a value from the first worksheet. My macro appears to be using the sheet name instead of the sheet code name. It's using the value from Sheet 2 instead of Sheet 1. Please let me know if I need to include more of the code. Thank you!

    Please Login or Register  to view this content.
    Last edited by critesd; 10-01-2015 at 08:46 AM. Reason: I did not follow forum rule 3.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,166

    Re: How do you use the sheet code name in a macro

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Never use Merged Cells in Excel

+ 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. Macro to input new code into each template sheet
    By nickyo88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2014, 05:07 AM
  2. [SOLVED] Edit Sheet Code Via Macro
    By boss1982 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-31-2013, 09:26 AM
  3. [SOLVED] Changing sheets using sheet code name on macro
    By ruliansyah in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-05-2013, 01:47 AM
  4. Replies: 2
    Last Post: 10-09-2012, 04:40 PM
  5. [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
  6. How to add code to sheet via Macro
    By panamakevin in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-21-2010, 10:31 PM
  7. 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

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