+ Reply to Thread
Results 1 to 6 of 6

Need macro to hide sheets in excel

Hybrid View

Shradharani Need macro to hide sheets in... 03-11-2015, 06:30 AM
alansidman Re: Need macro to hide sheets... 03-11-2015, 08:02 AM
Shradharani Re: Need macro to hide sheets... 03-11-2015, 08:09 AM
alansidman Re: Need macro to hide sheets... 03-11-2015, 08:20 AM
Shradharani Re: Need macro to hide sheets... 03-11-2015, 08:58 AM
alansidman Re: Need macro to hide sheets... 03-11-2015, 08:18 PM
  1. #1
    Registered User
    Join Date
    08-03-2012
    Location
    India.Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    97

    Need macro to hide sheets in excel

    Hi,

    I have many sheets in my excel among those sheets some are empty .There in no data in few of the sheets. Can you help to with the macro which will hide all those sheets which are empty and keep sheets which have data in it.

    Thank you ,
    Shradha

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,704

    Re: Need macro to hide sheets in excel

    In the non blank sheets, is there one cell that will always have a value in it? Perhaps A1?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    08-03-2012
    Location
    India.Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Need macro to hide sheets in excel

    Ok then is there any way to get macro to hide the sheets where value is only in A1 only in one cell and rest have more than one cell values.

    Thanks,Shradha

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,704

    Re: Need macro to hide sheets in excel

    This macro assumes that if A1 is blank then the entire sheet is blank and hides the sheet.

    Option Explicit
    
    Sub HideSheets()
        Dim ws As Worksheet
        Application.ScreenUpdating = False
        
        For Each ws In Worksheets
        If ws.Range("A1") = "" Then
        ws.Visible = xlSheetHidden
        End If
        Next ws
        Application.ScreenUpdating = True
    End Sub

  5. #5
    Registered User
    Join Date
    08-03-2012
    Location
    India.Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    97

    Re: Need macro to hide sheets in excel

    Thank you so much its working fine

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,704

    Re: Need macro to hide sheets in excel

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

+ 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] How to unhide/hide sheets with Macro?
    By jgomez in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-04-2013, 11:22 AM
  2. conflict between auto save&close macro and show/hide sheets macro
    By alexandruc in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-18-2009, 11:56 AM
  3. Hide/ Unhide Sheets with macro
    By cispus78 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-10-2008, 04:47 PM
  4. macro to hide and unhide sheets
    By EdMac in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-07-2007, 07:03 AM
  5. [SOLVED] macro to hide sheets
    By ditchy in forum Excel General
    Replies: 8
    Last Post: 05-01-2005, 10: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