+ Reply to Thread
Results 1 to 5 of 5

Refer to worksheet by the unique name

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    596

    Refer to worksheet by the unique name

    Hello,
    I have a worksheet which shows up in the "Project- VBAProject" window as:
    Sheet1(My Name)

    I want to turn this worksheet to invisible , tried this code:
    Sheets("My Name").visible= False
    which works as long as I don't change the worksheet name.

    My question is , what would be the code to refer to this worksheet by "Sheet1" name, regardless of the worksheet position from left to right in the workbook.

    Thanks

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,984

    Re: Refer to worksheet by the unique name

    How about
    Sheet1.Visible=False
    Although it will only work if the code is in the same workbook.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    13,035

    Re: Refer to worksheet by the unique name

    The value that you see in the cell to the right of*(Name)*in the Properties window is the code name
    It's possible for the sheet (tab) name to be different from the code name. When you create a sheet, the sheet (tab) name and code name are the same, but changing the sheet (tab) name doesn't change the code name
    Sheet1.Visible = xlSheetHidden
    Sheet1.Visible = xlSheetVisible
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    03-02-2014
    Location
    usa
    MS-Off Ver
    MS 365
    Posts
    596

    Re: Refer to worksheet by the unique name

    Thank you!

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,984

    Re: Refer to worksheet by the unique name

    Glad to help & thanks for the feedback.

+ 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. Refer to cell in other worksheet by ROW()
    By jokris in forum Excel General
    Replies: 2
    Last Post: 04-08-2016, 11:26 AM
  2. Replies: 2
    Last Post: 03-21-2015, 06:46 AM
  3. How to refer the last worksheet ?
    By Ravi99522 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-27-2012, 01:27 PM
  4. Refer to a worksheet
    By superbob in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-16-2010, 03:21 AM
  5. Refer to another worksheet
    By Artarta in forum Excel General
    Replies: 3
    Last Post: 11-15-2006, 08:13 AM
  6. [SOLVED] refer to last cell in worksheet?
    By svh646 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-24-2006, 08:30 PM
  7. Refer to a worksheet from a userform
    By leonidas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2006, 07:45 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