Hide Unhide Rows based on Cell Value

Abhishek1988

New Member
Joined
Oct 22, 2018
Messages
27
Hello Team,

I have a workbook and containing somedata in rows but i want to show them based on cell value. Bydefault rows should be hide.


I have data in.
$5:$10
$13:$18
$21:$$26

I want if A1=1 and post click on button $5:$10 should be unhide and all below should be hide.

Same if A1=2 and post.click on button $13:$18 should be unhide and all ($5:$10 and $21:$26) should be hide.

Please help me. Thanks in advance
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi Abhishek1988,

Try this:

Code:
Option Explicit
Sub Macro1()

    Application.ScreenUpdating = False

    Select Case Range("A1")
        Case Is = 1
            Range("5:10").EntireRow.Hidden = False
            Range("13:18,21:26").EntireRow.Hidden = True
        Case Is = 2
            Range("13:18").EntireRow.Hidden = False
            Range("5:10,21:26").EntireRow.Hidden = True
    End Select

    Application.ScreenUpdating = True
    
End Sub

Regards,

Robert
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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