Results 1 to 9 of 9

How to refer to the (NAME) of the Sheet rather than the Name of the sheet in my macro

Threaded View

  1. #1
    Registered User
    Join Date
    09-11-2013
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Question How to refer to the (NAME) of the Sheet rather than the Name of the sheet in my macro

    Dear Sirs,
    I am running this easy macro, see below. My problem is that it only works if the sheet (tabs) are called 1, 2, 3, 4,...etc. The users of the spreadsheet often change the TAB sheets so I would like the macro to refer to the actual (NAME) of the sheet, the one that you find first under the PROPERTIES section of the Microsoft Visual Basic Editor. Could anyone help?

    Kind regards
    Creare


    Sub Unhide_all()
    '
    ' Unhide_all Macro
    ' To unhide all rows on all the scope tabs
    '
    ' Keyboard Shortcut: Ctrl+Shift+U
    '
        Sheets("1").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("2").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("3").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("4").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("5").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("6").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("7").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("6").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("8").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("9").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("10").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("11").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("12").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("13").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("14").Select
        Range("A9").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
        Sheets("15").Select
        ActiveSheet.Range("$A$9:$A$480").AutoFilter Field:=1
    End Sub
    Last edited by Fotis1991; 09-11-2013 at 04:15 AM. Reason: add code tags as for OP is his(her) first post!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 12-16-2012, 04:24 PM
  2. Replies: 2
    Last Post: 08-21-2012, 09:15 AM
  3. [SOLVED] Refer to a hidden sheet using a macro.
    By fullers in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2005, 10:35 AM
  4. [SOLVED] Refer new sheet to previous sheet
    By Spot in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-09-2005, 09:05 AM
  5. Have macro refer to formerly active sheet
    By chaminod in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-07-2005, 06:11 PM

Tags for this Thread

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