Results 1 to 6 of 6

Macro that hides/unhides sheets depending on cell value

Threaded View

  1. #1
    Registered User
    Join Date
    01-12-2011
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    11

    Macro that hides/unhides sheets depending on cell value

    Hi

    My knowledge of VB is pretty limited and I have tried with no success to find a macro that will unhide/hide sheets depending on a returned value in once particular cell. I have pretty much read every forum post and am still stumped.

    So far I have got this but I know that Worksheet_Change doesn't run when the value of the target cell contains a formula (an IF "true or false" formula)

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Target.Address <> "$B$59" Then Exit Sub
    If Target.Value = "TRUE" Then
    
                Worksheets("Sheet1").Visible = xlSheetVisible
                Worksheets("Sheet2").Visible = xlVeryHidden
                Worksheets("Sheet3").Visible = xlVeryHidden
                
           Else
           
                Worksheets("Sheet1").Visible = xlSheetVisible
                Worksheets("Sheet2").Visible = xlSheetVisible
                Worksheets("Sheet3").Visible = xlSheetVisible
    
    End If
    End Sub
    I have looked at Worksheet_Calculate but just don't know what to go.

    Any help would be much appreciated.
    Thanks
    Ben
    Last edited by DonkeyOte; 01-13-2011 at 05:10 AM. Reason: CODE tags please...

Thread Information

Users Browsing this Thread

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

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