+ Reply to Thread
Results 1 to 2 of 2

Change Marcro Name

  1. #1
    Registered User
    Join Date
    11-18-2019
    Location
    Apple Valley, Minnesota
    MS-Off Ver
    365
    Posts
    20

    Change Marcro Name

    Hi,

    I have a simple macro that I've created to ToggleHide columns in a single worksheet in my workbook and while the macro works fine, when I click on Macros and see the Macro name, it displays Sheet26Hide_Columns_Toggle. How can I rename this to the actual sheet name instead of the sheet number?

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Change Marcro Name

    Are you talking about the macro procedure name, i.e.
    Please Login or Register  to view this content.
    or a line of code within the procedure which is referencing Sheet26?

    If the former just change the characters 'Sheet26' to whatever you want. The procedure name though can't have any spaces so if your sheet name was say "My Sheet", you'd have to use character in the middle i.e. My_Sheet.


    If however you're referring to code which says Sheet26....etc, i.e. the VBA sheet code name then I'd caution you against changing it. Almost without exception references in macros to sheets should always use the sheet Code Name rather than the sheet Tab Name

    If you must use the tab name in code then you'd use Sheets("My_Sheet_TabName")
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

+ 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. Compare Marcro
    By JoanneA in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2013, 02:10 PM
  2. marcro triggering #N/A in cells
    By Kezwick in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-20-2011, 09:59 AM
  3. EXCEL 2010 Marcro/Add in
    By EAGLEBUCKS in forum Excel General
    Replies: 1
    Last Post: 05-24-2011, 09:39 AM
  4. Copy Marcro with Worksheet
    By mycon73 in forum Excel General
    Replies: 4
    Last Post: 01-10-2011, 10:32 AM
  5. Add rows without interfering with VBA marcro's
    By Stiff in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-19-2009, 10:24 AM
  6. Marcro to hyperlink to a file
    By FRIEL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2009, 08:38 AM
  7. [SOLVED] Protect Sheet with Marcro
    By Conditional Formatting in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-21-2005, 03:45 PM
  8. Recording a marcro
    By carrera in forum Excel General
    Replies: 6
    Last Post: 05-13-2005, 01:06 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