Hide / Unhide rows based on cell selection.

humsboyle

Board Regular
Joined
Aug 4, 2010
Messages
53
Evening all,
I am currently looking for a way to unhide rows when particular cells are clicked on (Nothing typed, just clicked on)
I.e
When Cell E5 is clicked on, Rows 33 & 34 are unhidden to display a message.
When Cell E6 is clicked on Rows 33 & 34 would be hidden again, but rows 36 & 37 would become unhidden. Etc Etc. upto Cell E9 unhidden rows.
If none of the rows are clicked on then rows 33 to 40 would stay hidden.

i have seen code
Private Sub Worksheet_Change(ByVal Target As Range)
' Code goes in the Worksheet specific module
Dim rng As Range
' Set Target Range, i.e. Range("A1, B2, C3"), or Range("A1:B3")
Set rng = Target.Parent.Range("A1")
' Only look at single cell changes
If Target.Count > 1 Then Exit Sub
' Only look at that range
If Intersect(Target, rng) Is Nothing Then Exit Sub
' Action if Condition(s) are met (do your thing here...)
If LenB(Target.Value) <> 0 Then
Range("A5,A11:A16").EntireRow.Hidden = False
Else: Range("A5,A11:A16").EntireRow.Hidden = True
End If
End Sub

from pages
http://www.mrexcel.com/forum/excel-questions/467136-hide-unhide-certain-rows-if-cell-populated.html

which seems to work in un-hiding the rows however i have to type into the cells in order for it to work.

i need the rows to unhide when i click on the cell.

Any help or pointers on how to create would be greatly appreciated.

Thanks

Steve
 
Thanks JLGwhiz for the explanation.
E9 is last cell that has any impact on the lost cells.

How do i mark as complete?

Thanks again for your help on this matter.
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,225,149
Messages
6,183,188
Members
453,151
Latest member
Lizamaison

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top