메인 컨텐츠로 가기

확인란을 사용하여 Excel에서 행 또는 열을 숨기거나 숨기는 방법은 무엇입니까?

확인란을 사용하여 특정 행이나 열을 숨기거나 숨김 해제해야한다고 가정합니다. 예를 들어, Active X Control 확인란을 선택하면 특정 행이나 열이 표시되고 그렇지 않으면 숨겨집니다. 이 기사에서는 확인란을 사용하여 Excel에서 행 또는 열을 세부 정보와 함께 숨기거나 숨김 해제하는 방법을 보여줍니다.

확인란을 사용하여 VBA 코드로 행 또는 열 숨기기 / 숨기기 해제


확인란을 사용하여 VBA 코드로 행 또는 열 숨기기 / 숨기기 해제

다음 VBA 코드는 확인란을 사용하여 특정 행 또는 열을 숨기거나 숨기는 데 도움이 될 수 있습니다.

1. 워크 시트에 Active X Control 확인란을 삽입 한 후 확인란을 마우스 오른쪽 버튼으로 클릭 한 다음 코드보기 오른쪽 클릭 메뉴에서. 스크린 샷보기 :

2. 에서 응용 프로그램 용 Microsoft Visual Basic 창에서 다음 VBA 코드를 복사하여 코드 창에 붙여 넣습니다.

VBA 코드 : 확인란을 사용하여 행 또는 열 숨기기 / 숨기기 해제

Private Sub CheckBox1_Click()
    [C:D].EntireColumn.Hidden = Not CheckBox1
End Sub

노트:

1. VBA 코드에서 [CD]. 전체 열 해당 확인란을 선택하거나 선택 취소하여 C 및 D 열을 숨기거나 숨기기를 해제합니다.

2. 6 : 9 행과 같은 특정 행을 숨기거나 표시하려면 [CD]. 전체 열[6 : 9]. 전체 행 VBA 코드에서.

3. 누르세요 다른 + Q 키를 동시에 닫아 응용 프로그램 용 Microsoft Visual Basic 창.

4. 이제 전원을 끄십시오. 디자인 모드 아래 개발자 아래 스크린 샷과 같이 탭 :

이제부터 확인란을 선택하면 지정된 행 또는 열이 표시됩니다. 선택하지 않으면 지정된 행 또는 열이 숨겨집니다.


관련 기사 :

최고의 사무 생산성 도구

🤖 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 (26)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Bei mir werden die Zellen nicht ausgeblendet, wenn das Kontrollkästchen wieder in aktiv ist.

Mein Ziel ist es mit dem aktiveren des Kontrollkästchen die Zeile 7 einzublenden und wenn ich den Haken wieder entferne sollte Zeile 47 wieder ausgeblendet sein.
Hilfe....
This comment was minimized by the moderator on the site
Hi Rose,
The following VBA code can help.
Private Sub CheckBox1_Click()
[47:47].EntireRow.Hidden = Not CheckBox1
End Sub
This comment was minimized by the moderator on the site
E para ocultar colunas não sequências?
Exemplo: A e C

Esta situação seria aplicado de que forma para A e C ?

"Sub CheckBox1_Click privada ()
[C:D].EntireColumn.Hidden = Não CheckBox1
End Sub"
This comment was minimized by the moderator on the site
Hi,
The following VBA code can do you a favor. Please give it a try.
Private Sub CheckBox1_Click()
'Updated by Extendoffice 20220810
    [C:C, A:A].EntireColumn.Hidden = Not CheckBox1
End Sub
This comment was minimized by the moderator on the site
Bom dia!
Espero que todos estejam bem!

Tenho uma situação onde preciso ocultar / reexibir a coluna utilizando o Control ActiveX quando solecionado o item.

Exemplo: Tenho coluna com os nomes: Planejado, Realizado, Análise Vertical, Análise Vertical, Variação (R$) e Variação (%), no entanto, que poder selecionar individual as colunas intercalando se necessário. Selecionar somente a coluna Realizado e Variação, mesmo não estando na sequencia.

Desde já agradeço,
Welington
This comment was minimized by the moderator on the site
Hi,
Sorry I don't understand what you mean. Would you mind providing a screenshot of your data?
You may need to attach a screenshot or a sample file to describe the problem you encountered more clearly.
This comment was minimized by the moderator on the site
Esse código oculta, mas não executa a reexibição quando desmarcar.

Alguém pode complementar por favor? Preciso de um código para ocultar e reexibir colunas indicadas.

Private Sub CheckBox1_Click()
[C:D].EntireColumn.Hidden = Not CheckBox1
End Sub

Obrigado
This comment was minimized by the moderator on the site
Hi Welington Mesquita,
This VBA code can acheive:
When the checkbox1 is checked, the column C:D are displayed;
When it is unchecked, the column C:D are hidden.
The code works well in my case. Which Excel version are you using?
This comment was minimized by the moderator on the site
What if i wanted to use 3 different checkboxes and wanted them to each toggle hiding different groups of rows? I have tried and looked all over. When I try to modify this code the checkboxes seem to interfere with each other.
This comment was minimized by the moderator on the site
What if i wanted to use 3 different checkboxes and wanted them to each toggle hiding different groups of rows? I have tried and looked all over. When I try to modify this code the checkboxes seem to interfere with each other.
This comment was minimized by the moderator on the site
Very useful, but how can I use it to hide just a part of the spreadsheet? I mean for example cells B2:B11, how to combine those two functions? Thanks.
This comment was minimized by the moderator on the site
It worked, but then when I saved the file, and reopen it doesn't work. I tried saving it as a Macro excel sheet and as a regular workbook. What have I done wrong? I want to give it to someone else to use and don't want them to be confused.
This comment was minimized by the moderator on the site
Hi angela,After adding the code into workbook, please click File > Save as, choose where to save the file, in the Save As dialog box, choose Excel Macro-Enabled Workbook (*.xlsm) from the Save as type drop-down, and finally click Save. Then send this Excel Macro-Enabled workbook to others.
This comment was minimized by the moderator on the site
I was try to unhide the first three role but it was not work.How can I do it ,I know it the person who send me that file wanna know my skill I can solve it or not.
This comment was minimized by the moderator on the site
Hi May,
Sorry I didn't get your point.
This comment was minimized by the moderator on the site
Hello,

Is there a way to hide only one row. If I put 6:9 all rows are hidden, but if I only put 6, it comes out as error. Would appreciate your help, thank you!
This comment was minimized by the moderator on the site
Hi,
Please change the second line in the code to:
[6:6].EntireRow.Hidden = Not CheckBox1.
Thank you for your comment.
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