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

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
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'!
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,913
Members
449,093
Latest member
dbomb1414

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