#1   Report Post  
Davidjc52
 
Posts: n/a
Default 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   Report Post  
Chip Pearson
 
Posts: n/a
Default 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" wrote in
message
...
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   Report Post  
Davidjc52
 
Posts: n/a
Default 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" wrote in
message
...
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   Report Post  
Davidjc52
 
Posts: n/a
Default 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" wrote in
message
...
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   Report Post  
Chip Pearson
 
Posts: n/a
Default 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" wrote in
message
...
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" wrote in
message
...
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   Report Post  
Dave Peterson
 
Posts: n/a
Default 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" wrote in
message
...
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   Report Post  
Davidjc52
 
Posts: n/a
Default 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" wrote in
message
...
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" wrote in
message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding rows based on choice in a listbox robhargreaves Excel Discussion (Misc queries) 1 July 24th 05 12:58 PM
Hiding of rows and columns srinivasan Excel Discussion (Misc queries) 1 July 21st 05 08:59 AM
HIDING ROWS IN PROTECTED WORKSHEETS kyoung Excel Discussion (Misc queries) 2 June 9th 05 05:17 AM
Hiding Rows if the linked rows are blank KG Excel Discussion (Misc queries) 9 May 18th 05 02:32 AM
Copying Rows when hiding other rows Neutron1871 Excel Worksheet Functions 2 November 3rd 04 11:38 PM


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"