+ Reply to Thread
Results 1 to 6 of 6

MACRO: Hide sheet if cell is empty

  1. #1
    Registered User
    Join Date
    02-15-2020
    Location
    Warsaw
    MS-Off Ver
    2007
    Posts
    4

    MACRO: Hide sheet if cell is empty

    Dear programmers,
    A huge request 4 MACRO that if detects empty cell A2 hide active worksheet.

    Something like that:

    Please Login or Register  to view this content.
    Spent hours on the project and got stuck on a silly function.
    Thanks in advance
    Last edited by AliGW; 02-15-2020 at 06:40 PM.

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: MACRO: Hide sheet if cell is empty

    Hi karajakatak and welcome to the forum.

    Try this:
    Please Login or Register  to view this content.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: MACRO: Hide sheet if cell is empty

    Hi karajakatak and welcome to the forum.

    Try this:
    Please Login or Register  to view this content.
    The above code must go in a Module and not behind a worksheet.

  4. #4
    Registered User
    Join Date
    02-15-2020
    Location
    Warsaw
    MS-Off Ver
    2007
    Posts
    4

    Re: MACRO: Hide sheet if cell is empty

    Thank You vary much,
    Works perfectly

    One more question. I want to select all sheets except first one in this macro:

    Please Login or Register  to view this content.
    Would you help me? Need to make it work in next 8 hours :D
    Last edited by karajakatak; 02-16-2020 at 09:49 PM.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: MACRO: Hide sheet if cell is empty

    Hey kara,

    I'm so glad you got back to me. I didn't like my first code as it should made sheets hidden if they didn't have stuff in A2. See the new code and example attached.

    Sheets can be addressed by Name, Index or the "Each" routines. In the new code used the worksheets.count line to find how many sheets there are and the For .. Next .. routine to do the add-on question.

    Also - could you edit your reply above, select the code and click on the "#" button to put the code in a box.

    Please Login or Register  to view this content.
    (also - thanks for the rep)
    VBA Worksheets Each and For Next.xlsm

  6. #6
    Registered User
    Join Date
    02-15-2020
    Location
    Warsaw
    MS-Off Ver
    2007
    Posts
    4

    Re: MACRO: Hide sheet if cell is empty

    Much thanks Marvin 4 quick reply
    Code works well, we can close a Thread.

+ 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. VBA to hide empty rows in different sheet
    By HereComesTheBoom in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2018, 06:48 AM
  2. [SOLVED] Hide sheet if empty cell
    By Berna11 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-14-2018, 05:49 PM
  3. [SOLVED] Macro to copy cell value of Sheet1 to next empty cell of colum A in Sheet 2
    By JamesFinch in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-15-2014, 02:54 PM
  4. Replies: 0
    Last Post: 03-20-2014, 11:51 AM
  5. Hide Rows on one Sheet based on cells in another sheet being empty
    By KDF in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-15-2013, 01:48 PM
  6. Macro Required - Hide columns where cell in a single column is empty
    By heatwave in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2012, 12:53 AM
  7. Macro to hide sheet based on cell value within the sheet
    By a_dub_green in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 01-04-2012, 12:18 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