메인 컨텐츠로 가기

단추를 사용하여 Excel에서 열 숨기기를 표시하는 방법은 무엇입니까?

이 기사에서는 Excel에서 열을 표시하고 숨기는 단추를 만들고 사용하는 방법을 보여줍니다.

버튼을 사용하여 토글 버튼으로 열 숨기기 표시
단추를 사용하여 Excel 용 Kutools로 열 숨기기를 표시하십시오.


버튼을 사용하여 토글 버튼으로 열 숨기기 표시

토글 버튼을 클릭하여 숨기기 열을 표시 할 수 있습니다. 다음과 같이하십시오.

1. 클릭 개발자 > 끼워 넣다 > 토글 버튼 (ActiveX 컨트롤). 스크린 샷보기 :

주의 사항: 보이지 않는 경우 개발자 리본의 탭을 클릭하십시오. Excel에서 개발자 탭 표시 / 표시 활성화하는 방법을 알고 싶습니다.

2. 워크 시트에 토글 버튼을 그립니다. 마우스 오른쪽 버튼으로 클릭 한 다음 코드보기 오른쪽 클릭 메뉴에서. 스크린 샷보기 :

3. 열린 Microsoft Visual Basic 애플리케이션 창에서 코드 창의 모든 내용을 VBA 코드 아래로 바꿉니다.

VBA 코드 : 열 숨기기를 표시하는 버튼

Private Sub ToggleButton1_Click()
Dim xAddress As String
xAddress = "F:G"
If ToggleButton1.Value Then
    Application.ActiveSheet.Columns(xAddress).Hidden = True
Else
    Application.ActiveSheet.Columns(xAddress).Hidden = False
End If
End Sub

주의 사항: 코드에서 "F : G"는 코드를 실행하는 동안 F : G 열이 표시되고 숨겨지는 것을 의미합니다. 필요에 따라 변경하십시오.

4. 프레스 다른 + Q 키를 동시에 닫아 Microsoft Visual Basic 애플리케이션 창.

5. 전원 끄기 디자인 모드 클릭으로 개발자 > 디자인 모드.

이제 토글 버튼을 클릭하면 지정된 열이 즉시 숨겨집니다.

다시 클릭하면 열이 표시됩니다.


단추를 사용하여 Excel 용 Kutools로 열 숨기기를 표시하십시오.

워크 시트에 이미 숨겨진 열이있는 경우 Excel 용 Kutools모든 숨겨진 열 숨기기 해제 / 숨기기 전환 유틸리티를 사용하면 클릭 한 번으로 빠르게 표시하고 숨길 수 있습니다.

신청하기 전에 Excel 용 Kutools, 제발 먼저 다운로드하여 설치하십시오..

1. 클릭 쿠툴 > 항해.

2. 이동 열 목록 창을 클릭 한 다음 모든 숨겨진 열 숨기기 해제 / 숨기기 전환 버튼을 눌러 현재 워크 시트의 열을 표시하거나 숨 깁니다.

  이 유틸리티의 무료 평가판 (30 일)을 받으려면 그것을 다운로드하려면 클릭하십시오을 클릭 한 다음 위 단계에 따라 작업 적용으로 이동합니다.


단추를 사용하여 Excel 용 Kutools로 열 숨기기를 표시하십시오.

최고의 사무 생산성 도구

🤖 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 (17)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
Hello, I hope you are well.
If you can help me... I'd appreciate it. I would like to include an image in the button, would it be possible to place it directly in this code?
Rated 4 out of 5
This comment was minimized by the moderator on the site
Hi Eliza,

You can add a picture to a Toggle Button using its "Picture" property. Here's how to do it:
Right click the button and select Properties, in the Properties dialog box, go to the Categoried tab, look for the "Picture" property, click the ellipsis (...) next to the "Picture" property to open the file dialog and then you can select the picture you want.
This comment was minimized by the moderator on the site
Hi, Crystal
It doesn't work perfectly as I wanted, I had already tried... But I managed to do it another way. Thanks for the help! :)
Your content is very educational and helps many people, keep it up.
Rated 5 out of 5
This comment was minimized by the moderator on the site
Olá, espero que você esteja bem.
Se conseguir me ajudar.. agradeço. Gostaria de incluir uma imagem no botão, seria possível colocar diretamente nesse código?
This comment was minimized by the moderator on the site
Hi what is the code to hide rows instead of columns
Thanks
This comment was minimized by the moderator on the site
Hi Andy,
This VBA code can help. Please give it a try. Thank you.
You need to change the row number in the xAddress line to the rows you want to hide.
Private Sub ToggleButton1_Click()
'Updated by Extendoffice 20230915
Dim xAddress As String
xAddress = "5:10"
If ToggleButton1.Value Then
    Application.ActiveSheet.Rows(xAddress).Hidden = True
Else
    Application.ActiveSheet.Rows(xAddress).Hidden = False
End If
End Sub
This comment was minimized by the moderator on the site
Bonjour,

Top cela fonctionne bien !!

Cependant dans mon cas de figure je masque plusieurs groupes de colonnes ( ex : un bouton 1 pour masquer les colonnes D:E et un bouton 2 pour masquer les colonnes I:K). Comment faire pour que je puisse masquer un groupe de colonnes de façon indépendante et que je ne sois pas obligé d'activer le bouton 1 afin de pouvoir activer le bouton 2 ?

Je débute merci d'avance :)
This comment was minimized by the moderator on the site
Great written tutorial, but how do I create this button on a shared Excel sheet?
This comment was minimized by the moderator on the site
Hi Madison Taylor Delgado,
Are your workbooks shared on OneDrive or other applications? I am not able to solve this problem yet. Sorry for that.
This comment was minimized by the moderator on the site
Bom dia!

Eu gostaria de ajuda com um código para Control ActiveX onde eu pudesse selecionar colunas intercaladas.

Obrigado
This comment was minimized by the moderator on the site
I tried the formula on 3 buttons. The problem is they hide and unhide according to the sequenced they are inputted in the code. Is there anyway that I can click any button that will show/hide the columns not in sequence?
This comment was minimized by the moderator on the site
Adding to Ryan's comment, how about hiding a column based on the value of a cell? Basically making the xAdress an IF-function and not a predetermined range of columns.
This comment was minimized by the moderator on the site
Dear Liz,

Thank you for your comment!

VBA code in this tutorial can help you hiding specified columns based on the value of a cell. Please follow the below hyperlink to know more details.
https://www.extendoffice.com/documents/excel/2682-excel-hide-columns-based-on-dropdown-list.html
This comment was minimized by the moderator on the site
Hi there, How would you change it to select a bunch of non-adjacent cells?
This comment was minimized by the moderator on the site
Dear Ryan,

If you need to select a bunch of non-adjacent cells (every selected cell is interval of X cell) as below screenshot shown, please try the Select Interval Rows & Columns utility of Kutools for Excel.

You can also follow this link to know more about this feature. Thank you!
https://www.extendoffice.com/product/kutools-for-excel/excel-select-interval-rows-or-columns.html
This comment was minimized by the moderator on the site
Dear Ryan,

About the bunch of non-adjacent cells you need to select, can you provide a screenshot to show where they locating in your worksheet?
Thank you for your comment.
This comment was minimized by the moderator on the site
This was very helpful, thanks!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations