메인 컨텐츠로 가기

 Excel에서 여러 시트에 동일한 필터를 적용하는 방법은 무엇입니까?

필터 기능을 적용하여 워크 시트의 데이터를 필터링하는 것은 쉬울 수 있지만 때로는 동일한 필터 기준을 사용하는 공통 데이터 형식이있는 여러 워크 시트를 필터링해야 할 수도 있습니다. 하나씩 필터링하려면 많은 시간이 낭비됩니다. 여기서는 한 번에 쉽게 해결할 수있는 방법을 소개 할 수 있습니다.

VBA 코드를 사용하여 여러 워크 시트에 동일한 필터 적용


화살표 블루 오른쪽 거품 VBA 코드를 사용하여 여러 워크 시트에 동일한 필터 적용

예를 들어 다음 스크린 샷을 Product = KTE와 동일한 기준으로 한 번에 필터링해야하는 XNUMX 개의 워크 시트가 있습니다.

문서 필터 여러 시트 1

Excel에서 여러 시트의 데이터를 직접 필터링하는 방법은 없지만 다음 VBA 코드가이 작업을 완료하는 데 도움이 될 수 있습니다. 다음과 같이하십시오.

1. 누르고 ALT + F11 키를 누른 다음 응용 프로그램 용 Microsoft Visual Basic 창.

2. 딸깍 하는 소리 끼워 넣다 > 모듈을 클릭하고 다음 코드를 모듈 창문.

VBA 코드 : 여러 워크 시트에 동일한 필터 적용 :

Sub apply_autofilter_across_worksheets()
'Updateby Extendoffice
    Dim xWs As Worksheet
    On Error Resume Next
    For Each xWs In Worksheets
        xWs.Range("A1").AutoFilter 1, "=KTE"
    Next
End Sub

3. 그런 다음 F5 이 코드를 실행하려면 KTE의 모든 제품이 모든 워크 시트에서 한 번에 필터링되었습니다. 스크린 샷을 참조하십시오.

문서 필터 여러 시트 2

주의 사항: 위의 코드 내에서 xWs.Range ( "A1"). AutoFilter 1, "= KTE" 스크립트, A1= KTE 필터링 할 기준이되는 열과 기준을 나타내며 숫자 1은 필터링 한 기준이되는 열 번호이며 필요에 따라 변경할 수 있습니다. 예를 들어 50보다 큰 주문을 필터링하려면이 스크립트를 다음과 같이 수정하면됩니다. xWs.Range ( "B1"). AutoFilter 2, "> 50".


여러 기준 또는 기타 특정 조건 (예 : 텍스트 길이, 대소 문자 구분 등)으로 데이터를 필터링합니다.

Excel 용 Kutools슈퍼 필터 기능은 강력한 유틸리티이므로이 기능을 적용하여 다음 작업을 완료 할 수 있습니다.

  • 여러 기준으로 데이터를 필터링합니다. 텍스트 길이로 데이터 필터링;
  • 대문자 / 소문자로 데이터 필터링; 년 / 월 / 일 / 주 / 분기별로 날짜 필터링

문서 슈퍼 필터1

Excel 용 Kutools: 300 개 이상의 편리한 Excel 추가 기능으로 30 일 동안 제한없이 무료로 사용해 볼 수 있습니다. 지금 다운로드 및 무료 평가판!

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (48)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Hello, your code works really well. What about if I want to filter more than one cell value. For example: KTE and KTO? thank you for your help
This comment was minimized by the moderator on the site
Hello, your code works really well. What about if I want to filter more than one cell value. For example: KTE and KTO
This comment was minimized by the moderator on the site
Hi,
i have a work book 20+ sheets, and have to filter each sheet in different column but the same number "0 (Zero)" as in the column "P" in the attached image. along with i have to print preview the sheets which i have mentioned. How to di it sir. Each sheet has link with another or several sheets has linked to specific sheet.
This comment was minimized by the moderator on the site
Works a treat, thank you.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Is it possible to use the code to filter where it does not contain a zero.

I have a workbook with sheets up to 20 sometimes, where one column is always the same in each sheet, want to filter out all zeros.

Hope this makes sense.
This comment was minimized by the moderator on the site
Hello, Richard,
To filter the data exclude the zeros, please apply the below vba code:
Note: in the code, in this xWs.Range("C1").AutoFilter 3, "<>0" script, C1 and <>0 indicates the column and criteria which you want to filter based on, the number 3 is the column number you filtered based on, you can change them to your need.
Sub apply_autofilter_across_worksheets()
'Updateby Extendoffice
    Dim xWs As Worksheet
    On Error Resume Next
    For Each xWs In Worksheets
        xWs.Range("c1").AutoFilter 3, "<>0"
    Next
End Sub


Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
I want to use this code to filter on a column across multiple worksheets, the column will always have numbers in it, but I want the auto filter to remove zero values, leaving just minus and plus numbers.

Is this possible?
This comment was minimized by the moderator on the site
I have a spreadsheet with 2 tabs, I want that when I filter one tab, the other respects the filtered items and is also filtered with the same values, how to do that?
This comment was minimized by the moderator on the site
Hello, Fabio,
To solve your problem, you can use the VBA code in this article, and please remeber to change the cell reference and criteria in the code.
Please try again, hope it can help you!
This comment was minimized by the moderator on the site
I am copying and pasting exactly but keep getting "Compile Error: Invalid outside procedure". I have only changed the criteria to match what I need specifically.. below:

Sub apply_autofilter_across_worksheets()
'Updateby Extendoffice
Dim xWs As Worksheet
On Error Resume Next
For Each xWs In Worksheets
xWs.Range("D3").AutoFilter 1, "=Paige"
Next
End Sub
This comment was minimized by the moderator on the site
Hello, Paige,
I have tested your code, and it works well in my workbook.
Could you upload your excel file here, so that we can check where the problem is.
Thank you!
This comment was minimized by the moderator on the site
Amazing work! this macro is great.
This comment was minimized by the moderator on the site
Thank you skyyang Please how do i remove the hidden rows after filtering?
This comment was minimized by the moderator on the site
Hello, Akoma,
To remove all hidden rows after filtering, please apply the below code: (Note: This code will remove all hidden rows in the worksheet, and it will not undo, so you need backup your data.)
Sub DeleteHiddenRows()
Dim sht As Worksheet
Dim LastRow
Set sht = ActiveSheet
LastRow = sht.UsedRange.Rows(sht.UsedRange.Rows.Count).Row
For i = LastRow To 1 Step -1
If Rows(i).Hidden = True Then Rows(i).EntireRow.Delete
Next
End Sub

Please try, hope it can help you!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations