Hide same rows in Sheet2 after Filtering Sheet1

armando

Board Regular
Joined
Jun 24, 2003
Messages
157
Hi!, and Thanks in advance for any help.!

In Sheet1 I have some columns of data that I Filter by criterias choosen in other columns in the same Sheet1.

What I need is each time I filter in Sheet1, I want Sheet2 to hide the same rows that were hidden in Sheet1.

I have formulas in Sheet2 referring to data in Sheet1. And I want Sheet2 to show only the same rows that are shown in Sheet1.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

jimboy

Well-known Member
Joined
Apr 11, 2002
Messages
2,314
This will hide the same row as sheet1 (in range A1:A50), but you need to run it manually. You could put it in Sheet2 worksheet event (on activate)

Code:
Sub Macro1()
Dim c As Range
For Each c In Sheets("Sheet1").Range("A2:A50")
If Rows(c.Row).Hidden = False Then
Sheets("Sheet2").Rows(c.Row).Hidden = False
Else
Sheets("Sheet2").Rows(c.Row).Hidden = True
End If
Next c
End Sub

If you right mouse over Sheet2 and select view code, then paste this in, it will run when you select Sheet2...

Code:
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Rows.Hidden = False
Dim c As Range
For Each c In Sheets("Sheet1").Range("A2:A50")
If Sheets("Sheet1").Rows(c.Row).Hidden = True Then
Sheets("Sheet2").Rows(c.Row).Hidden = True
'Else
'Sheets("Sheet2").Rows(c.Row).Hidden = True
End If
Next c
Application.ScreenUpdating = True
End Sub

Not very fast tho'!
 
Learn Excel from Bill Jelen

Understanding data is crucial, and the easiest place to start is with Microsoft Excel.

Forum statistics

Threads
1,151,560
Messages
5,765,091
Members
425,258
Latest member
brentmitchell

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
Top