Results 1 to 7 of 7

Macro Hiding Sheet Not Working as Planned

Threaded View

  1. #1
    Registered User
    Join Date
    04-05-2016
    Location
    Philadelphia, Pennsylvania
    MS-Off Ver
    Microsoft Office Professional Plus 2013
    Posts
    40

    Macro Hiding Sheet Not Working as Planned

    Hi everyone - I'm trying to get a macro to hide a sheet in my workbook when a certain condition is met in a certain cell. In this case, when the cell (which I've named term) has the value "No Contract", I would like the sheet to hide itself.

    What I have is working, but not immediately upon entering "No Contract". For some reason, I have to enter "No Contract" and then click on the cell again to get it to hide, but I want it to be an immediate response to entering that value. I'm not very experienced in macros so I'm not sure where I'm going wrong.

    Here is what I've got - again the cell which I want to trigger this is called Term and the worksheet is called COMPASS:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = Me.Range("Term").Address Then
        If Target.Value = "No Contract" Then
            Sheets("COMPASS").Visible = False
        Else
            Sheets("COMPASS").Visible = True
        End If
    End If
    End Sub
    Any advice would be greatly appreciated!

    Thanks

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro working on incorrect sheet - hiding rows
    By Cchoma in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-08-2015, 01:27 AM
  2. Macro Not working - Consolidate different sheet into 1 sheet and merge into 1 tab
    By gpcarthik in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2014, 03:08 PM
  3. Hiding Sheets based on cell value, only hiding last sheet
    By mattblack2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2014, 03:21 PM
  4. [SOLVED] Macro for hiding rows before print not working
    By gocolonel77 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2013, 11:05 PM
  5. [SOLVED] Macro for hiding rows not working
    By sunilwadhwa in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-25-2012, 04:31 PM
  6. Code not working as planned
    By sulavsingh6 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2009, 03:53 PM
  7. Print Macro not working...hiding extra fields
    By LarryC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2008, 08:21 AM

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