+ Reply to Thread
Results 1 to 12 of 12

Hide and unhide Sheet according to a1 value

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Post Hide and unhide Sheet according to a1 value

    hello
    i want to hide my sheet if A1.value = 0(zero)
    and if unhide the sheet if A1.value = greater than 0(zero)

    thanx

  2. #2
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Hide and unhide Sheet according to a1 value

    this will hide / unhide all sheets, when you open the workbook, based on the value in cell 1,1 of each sheet.

    Please Login or Register  to view this content.
    Click on the star if you think I helped you

  3. #3
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Hide and unhide Sheet according to a1 value

    hello adyteo

    i don't want to hide all sheets
    i want only one particular sheet

  4. #4
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Hide and unhide Sheet according to a1 value

    Please Login or Register  to view this content.
    Last edited by adyteo; 04-11-2014 at 05:19 AM. Reason: added CODE

  5. #5
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Hide and unhide Sheet according to a1 value

    Its not working

  6. #6
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Hide and unhide Sheet according to a1 value

    what is not working? any errors?
    did you change "sheetname" to the name of your sheet?

  7. #7
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Hide and unhide Sheet according to a1 value

    i paste ur code in This workbook

    compile error in hidden module. this workbook. this error commonly occurs when code in incompatible with the veriosn
    Option Explicit

    Private Sub Workbook_Open()

    If sheet("v2").Cells(2, 3) = 0 Then sheet("v2").Visible = False Else sheet("v2").Visible = True

    End Sub

  8. #8
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Hide and unhide Sheet according to a1 value

    sorry, it was a typing mistake: I typed SHEET instead of SHEETS

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Hide and unhide Sheet according to a1 value

    but adyteo

    ur code works when i close and open workbook

    i want to work this code with open workbook

    i mean i m working on sheets("entry").........and sheets("v2").cells(3, 2) is linked with sheets("entry")
    i add a value in sheets("entry") then sheet("v2").cells(3, 2) 's value auto update
    after add value with open workbook hide or unhide this sheets

    thanx

  10. #10
    Valued Forum Contributor adyteo's Avatar
    Join Date
    01-10-2013
    Location
    Calgary
    MS-Off Ver
    Excel 2010
    Posts
    540

    Re: Hide and unhide Sheet according to a1 value

    check the attachmentHideUnhideSheet.xlsm

  11. #11
    Forum Contributor pipoliveira's Avatar
    Join Date
    08-09-2012
    Location
    Ireland
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    368

    Re: Hide and unhide Sheet according to a1 value

    Hi Haroon2015,

    Instead of "Private Sub Workbook_Open()" try "Private Sub Worksheet_Change()".

    Add this code by clicking the sheet with the right mouse button and choose "View Code".

    Hope it helps.

    Cheers.

  12. #12
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Hide and unhide Sheet according to a1 value

    adyteo

    which sample u gave me....................

    in ur sample file u added 1 vaue in "entry" sheet.. i want that value
    in sheet "V2".....

    if i leave the sheet "V2" and A1 value is greater then 0 then don't hide the sheet if value is = 0 then hide the sheet "V2"

+ 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] Hide / Unhide sheet
    By jani.pk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2014, 07:52 PM
  2. [SOLVED] Hide and Unhide one sheet
    By hecgroups in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-17-2012, 01:55 PM
  3. Hide and Unhide sheet
    By svirgo in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-23-2012, 08:11 PM
  4. sheet hide/unhide
    By arnab0711 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-27-2010, 03:52 AM
  5. unhide sheet, copy data, hide sheet - screenupdate = false
    By titus.hanke in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-08-2008, 02:46 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