메인 컨텐츠로 가기

Excel에서 머리글과 바닥 글을 보호하는 방법은 무엇입니까?

Excel에서는 셀을 빠르고 쉽게 보호 할 수 있지만 다른 사람이 셀을 수정하지 못하도록 머리글과 바닥 글을 보호 해 본 적이 있습니까? 일반적으로 워크 시트에서이 작업을 해결하는 직접적인 방법은 없지만 다음 VBA 코드가 도움이 될 수 있습니다.

VBA 코드로 머리글 및 바닥 글 보호


화살표 블루 오른쪽 거품 VBA 코드로 머리글 및 바닥 글 보호

머리글과 바닥 글은 워크 시트를 인쇄 할 때 유용합니다. 다른 사람이 변경하지 않도록하려면 다음 단계를 따르십시오.

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

2. 그런 다음 더블 클릭 이 워크북 아래 VBA 프로젝트 섹션을 클릭하여 빈 모듈을 연 후 다음 코드를 복사하여 모듈에 붙여 넣습니다.

VBA 코드 : 머리글 및 바닥 글 보호

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Call ProtectHF
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Call ProtectHF
End Sub
Private Sub Workbook_Open()
    Call ProtectHF
End Sub
Private Sub ProtectHF()
'Updateby Extendoffice
    Application.ScreenUpdating = False
    ThisWorkbook.ActiveSheet.PageSetup.RightHeader = ""
    ThisWorkbook.ActiveSheet.PageSetup.RightFooter = ""
    ThisWorkbook.ActiveSheet.PageSetup.CenterFooter = "KTE-Sale-Report"
    ThisWorkbook.ActiveSheet.PageSetup.CenterHeader = "Created by Skyyang"
    ThisWorkbook.ActiveSheet.PageSetup.LeftHeader = ""
    ThisWorkbook.ActiveSheet.PageSetup.LeftFooter = ""
    Application.ScreenUpdating = True
End Sub

문서 보호 머리글 바닥 글 1

주의 사항: 위 코드의 해당 위치에 머리글 또는 바닥 글 내용을 삽입 할 수 있습니다.

3. 그런 다음이 코드를 저장하고 닫습니다. 찜하기 버튼을 눌러이 통합 문서를 저장하면 머리글 또는 바닥 글을 변경하려고하면 수정 된 머리글 또는 바닥 글 콘텐츠가 자동으로 원래 항목으로 돌아갑니다. 스크린 샷 참조 :

문서 보호 머리글 바닥 글 2

최고의 사무 생산성 도구

🤖 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 (8)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
J'aime beaucoup, mais ce n'Est qu'une semi-sécurité pour l'en-tête. Je peux modifier les en-tête et les pied de page et imprimer avec la modification. Comment je pourrais empêcher toute modification exactement comme avec la protection de la feuille ???
This comment was minimized by the moderator on the site
Hello, Michael,
In fact, when you print the worksheet, the header or footer are not changed. It just changes the display in the Print Preview.
Please try it again, thank you!
This comment was minimized by the moderator on the site
Posso inserir uma imagem no cabeçalho?

Porque o meu cabeçalho é o logotipo da empresa.

Obrigada!
This comment was minimized by the moderator on the site
After shutting down and reopening the excel file, the header/footer can still be deleted. So how to fix this? 
Thank you very much!
This comment was minimized by the moderator on the site
Hello, Tracy,When you close the workbook, you should save it as Excel Macro-Enabled Workbook format, this will save the code.Reopening this file next time, please click Enable Content button from the top of the formula bar to activate the code.Please try, hope it can help you!
This comment was minimized by the moderator on the site
notas: Puede insertar el contenido del encabezado o pie de página en la ubicación correspondiente en el código anterior.
No entiendo ese paso , por favor si pueden explicarme, lo agradecería.
This comment was minimized by the moderator on the site
Hi used this with auto sheet name, file location, and page number and when saving it requires you to click in each field to print correctly.
This comment was minimized by the moderator on the site
Hi, Love the code to protect the header and footer, is there a way to change the font size, style, and color in the code so it is always replaced with a larger font?
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations