메인 컨텐츠로 가기

Excel의 머리글 / 바닥 글에 셀 값을 넣는 방법은 무엇입니까?

Excel의 기능을 사용하여 파일 경로, 파일 이름, 현재 날짜 또는 기타 정보가 포함 된 머리글 또는 바닥 글을 쉽게 삽입 할 수 있지만 때로는 Excel에서 머리글 또는 바닥 글로 셀 값을 사용하고 싶습니다. 통합 문서의 머리글이나 바닥 글에 셀 내용을 어떻게 넣을 수 있습니까?

VBA 코드를 사용하여 워크 시트의 머리글 또는 바닥 글에 셀 값 입력

VBA 코드가있는 모든 워크 시트의 머리글 또는 바닥 글에 셀 값 입력

Excel 용 Kutools를 사용하여 머리글 / 바닥 글에 파일 정보 삽입 좋은 생각 3


현재 워크 시트의 머리글 또는 바닥 글에 셀 내용을 배치하려는 경우 다음 VBA 코드가 도움이 될 수 있습니다. 다음 단계를 따르십시오.

1. 셀 값과 함께 herder 또는 footer를 삽입하려는 워크 시트를 활성화 한 다음 ALT + F11 키가 열립니다. Microsoft Visual Basic for Applications 창.

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

VBA 코드 : 워크 시트의 헤더에 지정된 셀 값 입력

Sub HeaderFrom()
'Update 20140318
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection.Range("A1")
Set WorkRng = Application.InputBox("Range (single cell)", xTitleId, WorkRng.Address, Type:=8)
Application.ActiveSheet.PageSetup.LeftHeader = WorkRng.Range("A1").Value
End Sub

3. 그런 다음 F5 이 코드를 실행하려면 해당 내용을 헤더에 넣을 셀을 선택하라는 대화 상자가 나타납니다.doc-insert-cell-value-to-header1

4. 그런 다음 OK,이 지정된 셀 값이 현재 워크 시트 왼쪽 머리글에 삽입되었습니다. 클릭하여 헤더를 볼 수 있습니다. 입양 부모로서의 귀하의 적합성을 결정하기 위해 미국 이민국에 > 인쇄. 스크린 샷보기 :doc-insert-cell-value-to-header1

배송 시 요청 사항:

1. 셀 내용을 활성 워크 시트의 바닥 글로 사용하려는 경우 다음 코드를 적용 할 수 있습니다.

VBA 코드 : 워크 시트의 바닥 글에 지정된 셀 값 입력

Sub FooterFrom()
'Update 20140318
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection.Range("A1")
Set WorkRng = Application.InputBox("Range (single cell)", xTitleId, WorkRng.Address, Type:=8)
Application.ActiveSheet.PageSetup.LeftFooter = WorkRng.Range("A1").Value
End Sub

2. 오른쪽 머리글 / 바닥 글 또는 가운데 머리글 / 바닥 글에 셀 값을 삽입하기 위해 위 코드를 적용 할 수도 있습니다. 왼쪽 헤더 / 왼쪽 바닥글오른쪽 헤더 / 오른쪽 바닥글 or 센터헤더 / 중앙 바닥글 코드에서.


때로는 선택한 셀의 내용이 포함 된 머리글 또는 바닥 글을 여는 통합 문서의 모든 워크 시트에 삽입하려는 경우 위 코드를 사용하여 여러 번 반복해야합니다. 이 경우 다음 VBA 코드는 전체 통합 문서의 herder 또는 footer에 한 번에 셀 콘텐츠를 추가 할 수 있습니다.

1. 셀 값과 함께 herder 또는 footer를 삽입하려는 통합 문서를 활성화 한 다음 ALT + F11 키가 열립니다. Microsoft Visual Basic for Applications 창.

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

VBA 코드 : 모든 워크 시트의 바닥 글에 지정된 셀 값 입력

Sub AddFooterToAll()
'Update 20140318
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection.Range("A1")
Set WorkRng = Application.InputBox("Range (single cell)", xTitleId, WorkRng.Address, Type:=8)
For Each ws In Application.ActiveWorkbook.Worksheets
    ws.PageSetup.LeftFooter = WorkRng.Range("A1").Value
Next
End Sub

3. 그런 다음 F5 키를 눌러이 코드를 실행하면 전체 통합 문서의 바닥 글에 해당 내용을 넣을 셀을 선택하라는 대화 상자가 나타납니다.

doc-insert-cell-value-to-header1

4. 그런 다음 OK,이 선택된 셀 값이 모든 워크 시트의 왼쪽 바닥 글에 추가되었습니다. 클릭하여 바닥 글을 볼 수 있습니다. 입양 부모로서의 귀하의 적합성을 결정하기 위해 미국 이민국에 > 인쇄. 스크린 샷보기 :

doc-insert-cell-value-to-header1

배송 시 요청 사항:

1. 전체 통합 문서의 헤더로 셀 내용을 사용하려면 다음 코드를 적용 할 수 있습니다.

VBA 코드 : 모든 워크 시트의 헤더에 지정된 셀 값 입력

Sub AddHeaderToAll()
'Update 20140318
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection.Range("A1")
Set WorkRng = Application.InputBox("Range (single cell)", xTitleId, WorkRng.Address, Type:=8)
For Each ws In Application.ActiveWorkbook.Worksheets
    ws.PageSetup.LeftHeader = WorkRng.Range("A1").Value
Next
End Sub

2. 대체 RightHeader / Footer or CenterHeader / Footer for LeftHeader / Footer 머리글 또는 바닥 글의 위치를 ​​다르게 지정하려면 위 코드에서.


워크 시트 / 통합 문서 이름, 통합 문서 경로 등과 같은 파일러 정보를 머리글 또는 바닥 글에 삽입하려면 다음을 사용할 수 있습니다. Excel 용 Kutools통합 문서 정보 삽입 Excel 용 Kutools를 설치 한 경우 유틸리티.

Excel 용 Kutools, 이상과 300 편리한 기능으로 작업이 더 쉬워집니다. 

무료 설치 Excel 용 Kutools는 다음과 같이하십시오.

1. 클릭 쿠툴즈 플러스 > 통합 문서 > 통합 문서 정보 삽입. 스크린 샷보기 :
문서 1

2. 에서 통합 문서 정보 삽입 대화 상자에서 삽입해야하는 정보를 확인하십시오. 정보 섹션 및 확인 헤더 or 바닥 글 당신이 원하는대로.

팁 : 머리글 또는 바닥 글의 세 위치 (중앙, 왼쪽 또는 오른쪽)에 정보를 삽입 할 수 있습니다.
문서 삽입 통합 문서 경로 1

3. 클릭 Ok. 그런 다음 갈 수 있습니다. 관측 > 페이지 레이아웃 헤더를 봅니다.
문서 3

통합 문서 정보 삽입을 사용하면 파일 정보를 셀 또는 셀 범위에 삽입 할 수도 있습니다. 이 유틸리티에 대한 자세한 내용을 보려면 여기를 클릭하십시오.



팁.통합 문서를 여러 통합 문서 / pdf 파일 또는 csv 파일로 빠르게 분할하려면 Excel 용 Kutools를 사용해보십시오. 통합 문서 분할 다음 스크린 샷에 표시된대로. 30 일 안에 제한없이 모든 기능을 사용할 수 있습니다. 지금 다운로드하여 무료 평가판을 받으십시오.

문서 분할 통합 문서

관련 기사 :

Excel의 셀 / 머리글 또는 바닥 글에 파일 이름 또는 경로를 삽입하는 방법은 무엇입니까?

Excel에서 머리글, 바닥 글 및 머리글 그림을 삽입하고 삭제하는 방법은 무엇입니까?

최고의 사무 생산성 도구

🤖 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 (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This doesn't appear to make a dynamic link, i.e., the value entered into the header doesn't change when the value of the cell does. So what is the purpose of the VBA code, when a copy/paste will do the same?
This comment was minimized by the moderator on the site
Hello, Neil,
If you want to link the cell value to the header or footer dynamically, please apply the following VBA code:

Note: You should insert the code into the sheet code not the normal Module.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim WorkRng As Range
Dim xStR As String
On Error Resume Next
xStR = "A1" '
Set WorkRng = Intersect(Application.ActiveSheet.Range("A1"), Target)
If WorkRng Is Nothing Then Exit Sub
Application.ActiveSheet.PageSetup.RightHeader = WorkRng.Range("A1").Value
End Sub


Please have a try, hope it can help you
This comment was minimized by the moderator on the site
maksudnya bagaimana?
This comment was minimized by the moderator on the site
Hi,

This appears to only work once.
What if the value of the cell changes?
Is there a way to link the cell so the header changes when the cell value changes?

I have a workbook where I have three sheets.

Sheet 1 labeled "Deletion Sheet" - Sheet we send to the warehouse with info what to palatalize for the order
Sheet 2 labeled "OA" - My order acknowledgement to the customer which pulls most of the data from the first sheet including the Order number which I need to have in my header. So I am trying to link the Header to the cell in this page with the order number (F5) which gets it's value from (C7) in the first work sheet ("Deletion Sheet")
Sheet 3 labeled "Invoice - Invoice which also pulls most of the same information from the first sheet which would also need the header to include the value (F5) of this sheet taken from (C7) in "Deletion Sheet"
This comment was minimized by the moderator on the site
When using your "VBA code: put a specified cell value in header of all worksheets", I would like the value placed to be formatted: Tahoma, bold, in font size 12.
How can this be added to your code?
This comment was minimized by the moderator on the site
Hi There, Is there a way that you can add a cell value which takes account of applied filters? For example... A1 = Monday A2 = Tuesday A3 = Wednesday. Using the VBA code to display cell A1 will work initially, but once I apply a filter on days of the week, the "top" cell value is no longer A1. Is there a way to pick up the variable? Many thanks,
This comment was minimized by the moderator on the site
I want to insert four cells in header.This VB is only for one cell. How can I do it. Thanks
This comment was minimized by the moderator on the site
You can try Concatenating the value of rht four cells into a single cell and then use the single cell as the header.
This comment was minimized by the moderator on the site
I needed to insert an active payroll date range into multiple sheets. The user opens the Payroll Date sheet, enters the date range and before she prints it updates all the sheets in the workbook. Here is how I am able to insert multiple cells into the range with a bit less code 2010 compatible: Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim WorkRng As Range On Error Resume Next For Each ws In Application.ActiveWorkbook.Worksheets ws.PageSetup.RightHeader = Range("'Payroll Date'!A1").Value & vbCr & Range("'Payroll Date'!A2").Value Next End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations