+ Reply to Thread
Results 1 to 7 of 7

Hiding rows

  1. #1
    Davidjc52
    Guest

    Hiding rows

    We would like to be able to enter a value in a cell and if it meets our
    predefined criteria the entire row would automatically hide. Is this possible
    in excel?

    Thanks

  2. #2
    Chip Pearson
    Guest

    Re: Hiding rows

    You can use and event procedure to do this (see
    http://www.cpearson.com/excel/events.htm for more info about
    events). Right click the sheet tab and choose View Code. In the
    VBA code module that appears, paste the following code:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$A$1" Then 'change cell as desired
    If Target.Value > 10 Then ' change criteria as desired
    Target.EntireRow.Hidden = True
    Else
    Target.EntireRow.Hidden = False
    End If
    End If

    End Sub



    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    message
    news:F0E8927F-5563-4B80-AD01-04076625CCDB@microsoft.com...
    > We would like to be able to enter a value in a cell and if it
    > meets our
    > predefined criteria the entire row would automatically hide. Is
    > this possible
    > in excel?
    >
    > Thanks




  3. #3
    Davidjc52
    Guest

    Re: Hiding rows

    Thank you Chip

    "Chip Pearson" wrote:

    > You can use and event procedure to do this (see
    > http://www.cpearson.com/excel/events.htm for more info about
    > events). Right click the sheet tab and choose View Code. In the
    > VBA code module that appears, paste the following code:
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > If Target.Address = "$A$1" Then 'change cell as desired
    > If Target.Value > 10 Then ' change criteria as desired
    > Target.EntireRow.Hidden = True
    > Else
    > Target.EntireRow.Hidden = False
    > End If
    > End If
    >
    > End Sub
    >
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    > "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    > message
    > news:F0E8927F-5563-4B80-AD01-04076625CCDB@microsoft.com...
    > > We would like to be able to enter a value in a cell and if it
    > > meets our
    > > predefined criteria the entire row would automatically hide. Is
    > > this possible
    > > in excel?
    > >
    > > Thanks

    >
    >
    >


  4. #4
    Davidjc52
    Guest

    Re: Hiding rows

    Chip,

    How would you set this to a range of cells in column A


    "Chip Pearson" wrote:

    > You can use and event procedure to do this (see
    > http://www.cpearson.com/excel/events.htm for more info about
    > events). Right click the sheet tab and choose View Code. In the
    > VBA code module that appears, paste the following code:
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    >
    > If Target.Address = "$A$1" Then 'change cell as desired
    > If Target.Value > 10 Then ' change criteria as desired
    > Target.EntireRow.Hidden = True
    > Else
    > Target.EntireRow.Hidden = False
    > End If
    > End If
    >
    > End Sub
    >
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    > "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    > message
    > news:F0E8927F-5563-4B80-AD01-04076625CCDB@microsoft.com...
    > > We would like to be able to enter a value in a cell and if it
    > > meets our
    > > predefined criteria the entire row would automatically hide. Is
    > > this possible
    > > in excel?
    > >
    > > Thanks

    >
    >
    >


  5. #5
    Chip Pearson
    Guest

    Re: Hiding rows

    David,


    Change

    If Target.Address = "$A$1" Then

    to

    If Not Application.Intersect(Target, Range("A1:A100")) Is
    Nothing Then


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com




    "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    message
    news:2882B3D7-55BD-4D1A-8140-37B50F94B6F5@microsoft.com...
    > Chip,
    >
    > How would you set this to a range of cells in column A
    >
    >
    > "Chip Pearson" wrote:
    >
    >> You can use and event procedure to do this (see
    >> http://www.cpearson.com/excel/events.htm for more info about
    >> events). Right click the sheet tab and choose View Code. In
    >> the
    >> VBA code module that appears, paste the following code:
    >>
    >> Private Sub Worksheet_Change(ByVal Target As Range)
    >>
    >> If Target.Address = "$A$1" Then 'change cell as desired
    >> If Target.Value > 10 Then ' change criteria as desired
    >> Target.EntireRow.Hidden = True
    >> Else
    >> Target.EntireRow.Hidden = False
    >> End If
    >> End If
    >>
    >> End Sub
    >>
    >>
    >>
    >> --
    >> Cordially,
    >> Chip Pearson
    >> Microsoft MVP - Excel
    >> Pearson Software Consulting, LLC
    >> www.cpearson.com
    >>
    >>
    >> "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    >> message
    >> news:F0E8927F-5563-4B80-AD01-04076625CCDB@microsoft.com...
    >> > We would like to be able to enter a value in a cell and if
    >> > it
    >> > meets our
    >> > predefined criteria the entire row would automatically hide.
    >> > Is
    >> > this possible
    >> > in excel?
    >> >
    >> > Thanks

    >>
    >>
    >>




  6. #6
    Dave Peterson
    Guest

    Re: Hiding rows

    One way...

    Private Sub Worksheet_Change(ByVal Target As Range)
    if target.cells.count > 1 then exit sub
    if intersect(target,me.range("a1:a25")) is nothing then exit sub

    If Target.Value > 10 Then ' change criteria as desired
    Target.EntireRow.Hidden = True
    Else
    Target.EntireRow.Hidden = False
    End If

    End Sub


    Davidjc52 wrote:
    >
    > Chip,
    >
    > How would you set this to a range of cells in column A
    >
    > "Chip Pearson" wrote:
    >
    > > You can use and event procedure to do this (see
    > > http://www.cpearson.com/excel/events.htm for more info about
    > > events). Right click the sheet tab and choose View Code. In the
    > > VBA code module that appears, paste the following code:
    > >
    > > Private Sub Worksheet_Change(ByVal Target As Range)
    > >
    > > If Target.Address = "$A$1" Then 'change cell as desired
    > > If Target.Value > 10 Then ' change criteria as desired
    > > Target.EntireRow.Hidden = True
    > > Else
    > > Target.EntireRow.Hidden = False
    > > End If
    > > End If
    > >
    > > End Sub
    > >
    > >
    > >
    > > --
    > > Cordially,
    > > Chip Pearson
    > > Microsoft MVP - Excel
    > > Pearson Software Consulting, LLC
    > > www.cpearson.com
    > >
    > >
    > > "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    > > message
    > > news:F0E8927F-5563-4B80-AD01-04076625CCDB@microsoft.com...
    > > > We would like to be able to enter a value in a cell and if it
    > > > meets our
    > > > predefined criteria the entire row would automatically hide. Is
    > > > this possible
    > > > in excel?
    > > >
    > > > Thanks

    > >
    > >
    > >


    --

    Dave Peterson

  7. #7
    Davidjc52
    Guest

    Re: Hiding rows

    Thank You Chip. That was perfect. Your website is a great source of
    information.

    David Curlis

    "Chip Pearson" wrote:

    > David,
    >
    >
    > Change
    >
    > If Target.Address = "$A$1" Then
    >
    > to
    >
    > If Not Application.Intersect(Target, Range("A1:A100")) Is
    > Nothing Then
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    >
    >
    > "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    > message
    > news:2882B3D7-55BD-4D1A-8140-37B50F94B6F5@microsoft.com...
    > > Chip,
    > >
    > > How would you set this to a range of cells in column A
    > >
    > >
    > > "Chip Pearson" wrote:
    > >
    > >> You can use and event procedure to do this (see
    > >> http://www.cpearson.com/excel/events.htm for more info about
    > >> events). Right click the sheet tab and choose View Code. In
    > >> the
    > >> VBA code module that appears, paste the following code:
    > >>
    > >> Private Sub Worksheet_Change(ByVal Target As Range)
    > >>
    > >> If Target.Address = "$A$1" Then 'change cell as desired
    > >> If Target.Value > 10 Then ' change criteria as desired
    > >> Target.EntireRow.Hidden = True
    > >> Else
    > >> Target.EntireRow.Hidden = False
    > >> End If
    > >> End If
    > >>
    > >> End Sub
    > >>
    > >>
    > >>
    > >> --
    > >> Cordially,
    > >> Chip Pearson
    > >> Microsoft MVP - Excel
    > >> Pearson Software Consulting, LLC
    > >> www.cpearson.com
    > >>
    > >>
    > >> "Davidjc52" <Davidjc52@discussions.microsoft.com> wrote in
    > >> message
    > >> news:F0E8927F-5563-4B80-AD01-04076625CCDB@microsoft.com...
    > >> > We would like to be able to enter a value in a cell and if
    > >> > it
    > >> > meets our
    > >> > predefined criteria the entire row would automatically hide.
    > >> > Is
    > >> > this possible
    > >> > in excel?
    > >> >
    > >> > Thanks
    > >>
    > >>
    > >>

    >
    >
    >


+ 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