Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Hiding Row based on cell value

I would like to hide row C17 based on the value entered in cell C16. For e.g.
If the value C16 is yes, C17 should remain in the unhide format. However, if
no is entered in cell c16, row c17 should be hidden. This should be executed
everytime the value of c16 is changed.

Thanks

--
Message posted via http://www.officekb.com
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,646
Default Hiding Row based on cell value

This is Worksheet_Change event procedu
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(False, False) = "C16" Then
If Target.Value = "yes" Then Rows("17").EntireRow.Hidden = False
If Target.Value = "no" Then Rows("17").EntireRow.Hidden = True
End If
End Sub

Post if you need help to install it!

Regards,
Stefi

€˛mohd21uk via OfficeKB.com€¯ ezt Ć*rta:

I would like to hide row C17 based on the value entered in cell C16. For e.g.
If the value C16 is yes, C17 should remain in the unhide format. However, if
no is entered in cell c16, row c17 should be hidden. This should be executed
everytime the value of c16 is changed.

Thanks

--
Message posted via http://www.officekb.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding Row based on cell value


have a worksheet change event look for the value in C16.

If yes then hide 17, conversely, do the opposite for no.


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=539208

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Hiding Row based on cell value

Hi,

paste this code into appropriate sheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$C$16" Then
Select Case UCase(Target.Value)
Case "YES"
Rows(17).Hidden = False
Case "NO"
Rows(17).Hidden = True
end select
End If
End Sub

It does exactly what you describe in your post.

Regards,
Ivan

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Hiding Row based on cell value

Here is an additional method:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address(0,0) = "C16" Then
Rows(17).Hidden = (lcase(target) = "no")
End If
End Sub

Right click on the sheet tab of this worksheet and select view code.
in the resulting code module, from dropdown at the top left of the module,
select Worksheet and from the right select Change (not selectionchange).
This will put the procedure declaration in the module. It is always best to
enter an event this way. then modify it to appear as above.

This will fire whenever a cell is edited, but the code only takes action
when the trigger cell is C16 (a reference to the trigger cell is contained in
the Target parameter of the event).

An overview of events can be found at Chip Pearson's site
http://www.cpearson.com/excel/events.htm

--
Regards,
Tom Ogilvy



"mohd21uk via OfficeKB.com" wrote:

I would like to hide row C17 based on the value entered in cell C16. For e.g.
If the value C16 is yes, C17 should remain in the unhide format. However, if
no is entered in cell c16, row c17 should be hidden. This should be executed
everytime the value of c16 is changed.

Thanks

--
Message posted via http://www.officekb.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding Row based on cell value


I have a workbook with several sheets containing data organized in rows.
The sheets contain the ALL possible information that I would want to
see. But, most of the time I only want to see select rows.

I have tried to think of the best way to do this, and I am trying to
set it up as follows...

Menu page - contains about 5 combo boxes with "yes" or "no" in each.
Each box would be used to evaluate what range of data I want to see.

All other sheets - have a dedicated column (AA) that links to the
yes/no questions.

If on the first combo box I select "yes", then it will look for all
rows in column AA of sheets 2, 3, and 4 and determine if they contain
the work "bird". If they do, then the row will remain. If I select
"no", then all rows containing "bird" will be deleted.

If on the second combo box I select "yes", then it will look for all
rows in column AA of sheets 2, 3, and 4 and determine if they contain
the work "dog". If they do, then the row will remain. If I select
"no", then all rows containing "dog" will be deleted.

...ETC.

The problem I see is that the original file should never be saved with
changes. After making selections in the 5 combo boxes, the user would
click submit and...

-all deletions would be made
-sheets 2, 3, and 4 would be saved in a new file
-original file closed without saving changes


--
TEAM
------------------------------------------------------------------------
TEAM's Profile: http://www.excelforum.com/member.php...o&userid=22810
View this thread: http://www.excelforum.com/showthread...hreadid=539208

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding Row based on cell value


why not use autofilter instead? Then you wont need to worry about not
saving


--
MattShoreson
------------------------------------------------------------------------
MattShoreson's Profile: http://www.excelforum.com/member.php...fo&userid=3472
View this thread: http://www.excelforum.com/showthread...hreadid=539208

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding Row based on cell value


I did not explain the issue as well as I should have. The autofilter
would work for what I said, but the output really needs to be more
formal and finalized than an autofilter screen...

After the sheets are shortened to only the needed information, they
will be sent out as a report to users. I think that the process needs
to be automated such that all preferences are made on an initial "menu"
sheet, all changes are made upon clicking submit, and a final output is
generated.

...any ideas?


Thanks.


--
TEAM
------------------------------------------------------------------------
TEAM's Profile: http://www.excelforum.com/member.php...o&userid=22810
View this thread: http://www.excelforum.com/showthread...hreadid=539208

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 cells based on the value in another cell Paul Kraemer Excel Discussion (Misc queries) 3 February 9th 10 04:10 PM
Hiding rows based on a cell? OX_Gambit Excel Worksheet Functions 3 July 10th 09 03:05 AM
hiding or showing rows based on a cell value jordanpcpre Excel Discussion (Misc queries) 6 April 24th 08 04:14 PM
Hiding rows based value of cell within row Legion_c18 Excel Discussion (Misc queries) 0 February 22nd 08 06:01 AM
hiding rows based on cell contents Jason M Excel Discussion (Misc queries) 1 October 30th 06 04:30 PM


All times are GMT +1. The time now is 09:14 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"