Row Hide in multiple sheets

rusa31

New Member
Joined
Jan 31, 2021
Messages
14
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
Hello,

I wanted to hide specific rows in multiple sheets.
I've sheet "Info" which have dropdown list (View,Hidden).
I also have sheets "Jan" to "Dec"

When i choose dropdown list "Hidden" in sheet "Info". It should hide all the specific rows (Example rows 1:10) in all sheets "Jan" to "Dec".

I have create the code but it doesnt work.

1613308366995.png


Really appreciate if someone can help me.

Thank you. :)
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Do all those sheets exist? Judging from your image you only have two of them.
Also in what way isn't it working?
 
Upvote 0
Do all those sheets exist? Judging from your image you only have two of them.
Also in what way isn't it working?

Hi Fluff,

So far i have created sheets Jan and Feb for testing. if the code works i will create the other sheets.

The codes doesnt work meaning when i choose "Hidden" in sheets "Info". The rows (1:44) in sheet Jan and Feb not Hide.
Its suppose to hide.

Thank you.
 
Upvote 0
How are you running the macro?
 
Upvote 0
How are you running the macro?

Im not sure how i running macro.
I just put the code in Excel Object "Sheet1(Info)".
then i just press "Alt-Q" to close. then i check if its works.

is this the rite way?
 
Upvote 0
is this the rite way?
Nope, that code will not run automatically.
To have it run automatically try
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
   Dim Ary As Variant
   Dim i As Long
   
   If Target.CountLarge > 1 Then Exit Sub
   If Target.Address(0, 0) = "A4" Then
      Ary = Array("Jan", "Feb")
      For i = 0 To UBound(Ary)
         If Evaluate("isref('" & Ary(i) & "'!A1)") Then
            Sheets(Ary(i)).Rows("1:44").Hidden = Target.Value = "Hidden"
         End If
      Next i
   End If
End Sub
Just add the rest of the sheet names to the array
 
Upvote 0
Thank You Fluff.
Codes works good.

Thank you. :D
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
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