Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to Hide Rows based on conditional value in cell

Hi,

I have seen lots of examples but can't get any to work - I have a job
sheet with approx 60 rows - the rows contain data applicable to
various types of job.

What I want to do is have the user select which job type they are
completing, and then automatically hide/unhide the rows that aren't
relevant to that job.

I have added a hidden column A with an If statement that returns 1 or
0 depending on if the row should be shown/hidden 1 to show - 0 to
hide)based on what the user picks as the job type.

Can anyone help with some sample code and maybe advice on how I can
get this to work ?

Thanks..
Nick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default How to Hide Rows based on conditional value in cell

you can use worksheet_change event to control the same.

For example if you want to do this based on your hidden A row

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
For Each cell In Range("A5:A60")
If cell.Value = 0 Then
cell.EntireRow.Hidden = True
ElseIf cell.Value = 1 Then
cell.EntireRow.Hidden = False
End If
Next
Application.ScreenUpdating = True
End Sub



Nick wrote:

Hi,

I have seen lots of examples but can't get any to work - I have a job
sheet with approx 60 rows - the rows contain data applicable to
various types of job.

What I want to do is have the user select which job type they are
completing, and then automatically hide/unhide the rows that aren't
relevant to that job.

I have added a hidden column A with an If statement that returns 1 or
0 depending on if the row should be shown/hidden 1 to show - 0 to
hide)based on what the user picks as the job type.

Can anyone help with some sample code and maybe advice on how I can
get this to work ?

Thanks..
Nick


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
Can visual basics hide rows based on cell values? Jerrypetch Excel Discussion (Misc queries) 4 September 11th 06 07:21 PM
hide rows based on cell value dummster New Users to Excel 1 February 15th 06 11:37 PM
hide rows based on value in cell dummster Excel Discussion (Misc queries) 0 February 15th 06 03:27 PM
Hide/Delete entire rows based in the content of one cell Clueless Excel Discussion (Misc queries) 2 October 3rd 05 02:40 PM
Code to hide rows based on cell contents Tim[_29_] Excel Programming 5 December 17th 03 02:59 PM


All times are GMT +1. The time now is 12:31 AM.

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

About Us

"It's about Microsoft Excel"