+ Reply to Thread
Results 1 to 5 of 5

Hide or unhide charts or objects

  1. #1
    Registered User
    Join Date
    09-26-2012
    Location
    Doha, Qatar
    MS-Off Ver
    Excel 2010
    Posts
    3

    Hide or unhide charts or objects

    Hello All, I have trolled through the forum and have not found anything which meets my exact requirements so any help would be greatful.

    Is it possible to hide or unhide a "group" (two grouped graphs) based on the value of another cell?

    The workbook is to large to post however ideally what I am looking for is something like;

    If the value in $C$28 = "Squash" then display "group 5" if not hide "group 5".

    I have already written macros which will automatically adjust the axis of each of graphs based on Min and Max values so if I could add a line to this which does the above that would be ideal.

    With Thanks
    Andrew

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,126

    Re: Hide or unhide charts or objects

    Please Login or Register  to view this content.
    right click sheet tab and pick View Code.
    Paste code into sheet object.

    Change name of group item to suit your workbook
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    09-26-2012
    Location
    Doha, Qatar
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Hide or unhide charts or objects

    Thanks Andy,

    Code works a treat, however I need to manually recalculate the reference cell each time. Sorry to ask such a basic question, however can we embed this ento my existing macro?

    This is a sample of what i have already;
    Sub Graph()
    '
    ActiveSheet.ChartObjects("CMJ").Activate
    With ActiveChart.Axes(xlValue)
    .MinimumScale = Range("$D$34").Value
    .MaximumScale = Range("$E$34").Value
    End With
    ActiveSheet.ChartObjects("VamEval").Activate
    With ActiveChart.Axes(xlValue)
    .MinimumScale = Range("$D$35").Value
    .MaximumScale = Range("$E$35").Value
    End With

    and this is the modified code you supplied which works;

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("B3")) Is Nothing Then
    ActiveSheet.Shapes("Rectangle 7").Visible = (StrComp(Range("B3").Value, "No", vbTextCompare) = 0)
    End If

    End Sub

    Greatly Appreciated
    Andrew

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,126

    Re: Hide or unhide charts or objects

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-26-2012
    Location
    Doha, Qatar
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Hide or unhide charts or objects

    Excellent, works a treat thanks Andy

+ Reply to Thread

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