How do I automatically hid rows on a cell selection?

garygrung

New Member
Joined
Dec 22, 2008
Messages
3
Hi

In one cell I have a Data Validation list so the users can choose a question. (Source: Choose, Automation?, No Automation?)

If they choose "Choose" I would like to hide rows 59 to 79.
If they choose "Automation?" I would like to hide rows 59 to 63.
And if they choose "No automation?" I would like to hide rows 64 to 79.


I have tried:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim i As Integer
Application.ScreenUpdating = False
If Range("C56:C56") = "Automation?" Then
        For i = 59 To 63
            Rows(i).RowHeight = 0
        Next i
      Else
        For i = 59 To 63
            Rows(i).RowHeight = 18.75
        Next i
    End If
End Sub

Great if I want to use one selection but not multiple.

Can you please help?

Thanks
Gary :mad:
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Welcome to the boards!

Try the following:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Rows(59 & ":" & 79).Hidden = False
Select Case Range("C56").value
    Case "Choose"
        Rows(59 & ":" & 79).Hidden = True
    Case "Automation?"
        Rows(59 & ":" & 63).Hidden = True
    Case "No automation?"
        Rows(64 & ":" & 79).Hidden = True
End Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,553
Members
449,038
Latest member
Guest1337

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