+ Reply to Thread
Results 1 to 4 of 4

Checkbox to hide/unhide named range

  1. #1
    Joel Mills
    Guest

    Checkbox to hide/unhide named range

    I have a chart embedded on a sheet and have named ranges that are plotted on
    the chart. I would like for the user to be able to use a UserForm to select
    the data series on the chart. I recorded this macro to try and learn the
    code necessary. I have assigned it to a checkbox control, but don't know
    how to hide or unhide the data when the box is checked/unchecked. Below is
    the code. I would like the Row selection based on the "Name" to either be
    hidden or visible. I will assign each checkbox to the series of data that
    will be include on the chart.

    Joel




    Sub RemoveEarly()
    '
    Application.Goto Reference:="TARGETEARLY"
    Selection.EntireRow.Hidden = True
    End Sub



  2. #2
    Tom Ogilvy
    Guest

    Re: Checkbox to hide/unhide named range

    Assuming a checkbox from the control toolbox toolbar:
    Perhaps:

    Private Sub Checkbox1_Change()
    Worksheets("Sheet1").Range("Targetearly") _
    .EntireRow.Hidden = Checkbox1.Value
    End Sub

    --
    Regards,
    Tom Ogilvy


    "Joel Mills" <millsj@bayltd.com> wrote in message
    news:uGvoLlTYFHA.2572@TK2MSFTNGP14.phx.gbl...
    > I have a chart embedded on a sheet and have named ranges that are plotted

    on
    > the chart. I would like for the user to be able to use a UserForm to

    select
    > the data series on the chart. I recorded this macro to try and learn the
    > code necessary. I have assigned it to a checkbox control, but don't know
    > how to hide or unhide the data when the box is checked/unchecked. Below

    is
    > the code. I would like the Row selection based on the "Name" to either be
    > hidden or visible. I will assign each checkbox to the series of data that
    > will be include on the chart.
    >
    > Joel
    >
    >
    >
    >
    > Sub RemoveEarly()
    > '
    > Application.Goto Reference:="TARGETEARLY"
    > Selection.EntireRow.Hidden = True
    > End Sub
    >
    >




  3. #3
    Joel Mills
    Guest

    Re: Checkbox to hide/unhide named range

    Tom,

    It's not from the control toolbox toolbar. I have it in the VBA Project
    form. I'm not sure which is the best approach. My Program makes heavy use
    of forms from the VBA Project. For consistency I'd like to stay with this
    approach.


    "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    news:%23wSX$pTYFHA.2380@tk2msftngp13.phx.gbl...
    > Assuming a checkbox from the control toolbox toolbar:
    > Perhaps:
    >
    > Private Sub Checkbox1_Change()
    > Worksheets("Sheet1").Range("Targetearly") _
    > .EntireRow.Hidden = Checkbox1.Value
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Joel Mills" <millsj@bayltd.com> wrote in message
    > news:uGvoLlTYFHA.2572@TK2MSFTNGP14.phx.gbl...
    >> I have a chart embedded on a sheet and have named ranges that are plotted

    > on
    >> the chart. I would like for the user to be able to use a UserForm to

    > select
    >> the data series on the chart. I recorded this macro to try and learn the
    >> code necessary. I have assigned it to a checkbox control, but don't know
    >> how to hide or unhide the data when the box is checked/unchecked. Below

    > is
    >> the code. I would like the Row selection based on the "Name" to either
    >> be
    >> hidden or visible. I will assign each checkbox to the series of data
    >> that
    >> will be include on the chart.
    >>
    >> Joel
    >>
    >>
    >>
    >>
    >> Sub RemoveEarly()
    >> '
    >> Application.Goto Reference:="TARGETEARLY"
    >> Selection.EntireRow.Hidden = True
    >> End Sub
    >>
    >>

    >
    >




  4. #4
    Joel Mills
    Guest

    Re: Checkbox to hide/unhide named range

    Tom,

    With a little work I was able to make these changes to make it work. Thanks
    againg for your help.

    Sub Series()
    Worksheets("Curve").Range("Targetearly").EntireRow.Hidden =
    ChartSeries.CheckBox1.Value
    End Sub



    "Tom Ogilvy" <twogilvy@msn.com> wrote in message
    news:%23wSX$pTYFHA.2380@tk2msftngp13.phx.gbl...
    > Assuming a checkbox from the control toolbox toolbar:
    > Perhaps:
    >
    > Private Sub Checkbox1_Change()
    > Worksheets("Sheet1").Range("Targetearly") _
    > .EntireRow.Hidden = Checkbox1.Value
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Joel Mills" <millsj@bayltd.com> wrote in message
    > news:uGvoLlTYFHA.2572@TK2MSFTNGP14.phx.gbl...
    >> I have a chart embedded on a sheet and have named ranges that are plotted

    > on
    >> the chart. I would like for the user to be able to use a UserForm to

    > select
    >> the data series on the chart. I recorded this macro to try and learn the
    >> code necessary. I have assigned it to a checkbox control, but don't know
    >> how to hide or unhide the data when the box is checked/unchecked. Below

    > is
    >> the code. I would like the Row selection based on the "Name" to either
    >> be
    >> hidden or visible. I will assign each checkbox to the series of data
    >> that
    >> will be include on the chart.
    >>
    >> Joel
    >>
    >>
    >>
    >>
    >> Sub RemoveEarly()
    >> '
    >> Application.Goto Reference:="TARGETEARLY"
    >> Selection.EntireRow.Hidden = True
    >> End Sub
    >>
    >>

    >
    >




+ 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