메인 컨텐츠로 가기

Word 테이블에 색상 코드 드롭 다운 목록을 삽입하는 방법은 무엇입니까?

내 Word 문서에 표가 있다고 가정하고 이제 표의 열에 색상 코드 드롭 다운 목록을 삽입하려고합니다. 드롭 다운에서 하나의 옵션을 선택하면 셀 색상이 빨간색이되고 드롭 다운에서 다른 옵션을 선택하면 다음 스크린 샷과 같이 셀 색상이 녹색이됩니다. Word 문서에서이 작업을 어떻게 해결할 수 있습니까?

문서 색상 코드 드롭 다운

VBA 코드로 Word 문서에 색상 코드 드롭 다운 목록 삽입


VBA 코드로 Word 문서에 색상 코드 드롭 다운 목록 삽입

다음 단계는 필요에 따라이 작업을 완료하는 데 도움이 될 수 있습니다. 먼저 드롭 다운 목록을 삽입 한 다음 드롭 다운의 색상을 적용합니다. 다음과 같이하십시오 :

1. 테이블에서 드롭 다운을 삽입 할 셀을 선택한 다음 개발자 > 드롭 다운 목록 콘텐츠 제어 아이콘, 스크린 샷 참조 :

문서 색상 코딩 드롭 다운 1

2. 드롭 다운이 특정 셀에 삽입 된 다음 개발자 > 등록, 스크린 샷 참조 :

문서 색상 코딩 드롭 다운 2

3. 에서 콘텐츠 컨트롤 속성 대화 상자에서 다음 작업을 수행하십시오.

(1.) 제목 이름을 Title 텍스트 상자;

(2.) 클릭 추가 버튼으로 이동 선택 추가 대화;

(3.) 선택 추가 대화 상자에서 드롭 다운 목록 항목을 표시 이름 텍스트 상자.

문서 색상 코딩 드롭 다운 3

4. 3 단계를 반복하여 필요에 따라 다른 드롭 다운 목록 항목을 삽입합니다.

5. 첫 번째 드롭 다운 목록을 만든 후 필요에 따라 복사하여 다른 셀에 붙여 넣을 수 있습니다. 스크린 샷보기 :

문서 색상 코딩 드롭 다운 4

6. 그런 다음 VBA 코드를 적용해야합니다. ALT + F11 키를 눌러 응용 프로그램 용 Microsoft Visual Basic 창.

7. 에서 응용 프로그램 용 Microsoft Visual Basic 창, 더블 클릭 이 문서 인사말 프로젝트-프로젝트 창을 열어 모드를 연 다음 다음 코드를 복사하여 빈 모듈에 붙여 넣습니다.

VBA 코드 : Word 문서의 표에 색상 코드 드롭 다운 목록 삽입 :

Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl.Range
    If ContentControl.Title = "Status" Then
        Select Case .Text
            Case "Complete"
                .Cells(1).Shading.BackgroundPatternColor = wdColorRed
            Case "In Progress"
                .Cells(1).Shading.BackgroundPatternColor = wdColorGreen
            Case "Not Start"
                .Cells(1).Shading.BackgroundPatternColor = wdColorBlue
            Case Else
                .Cells(1).Shading.BackgroundPatternColor = wdColorAutomatic
        End Select
    End If
End With
End Sub

문서 색상 코딩 드롭 다운 5

주의 사항: 위 코드에서 Status 드롭 다운 목록을 만들 때의 제목 이름입니다. 완료, 진행 중, 시작하지 않음 드롭 다운 목록의 항목이므로 원하는 항목으로 변경할 수 있습니다. 또한 필요에 따라 색상을 변경할 수도 있습니다.

8. 그런 다음 코드 창을 저장하고 닫습니다. 이제 드롭 다운 목록에서 하나의 항목을 선택하면 상대 색상이 셀로 채워집니다. 스크린 샷을 참조하십시오.

문서 색상 코드 드롭 다운


 

최고의 사무 생산성 도구

Word 용 Kutools - Over로 단어 경험을 향상시키세요 100 놀라운 기능!

🤖 Kutools AI 도우미: AI로 글쓰기를 변화시키세요 - 콘텐츠 생성  /  텍스트 다시 쓰기  /  문서 요약  /  정보 문의 문서 기반, 모두 Word 내에서

📘 문서 숙달: 페이지 분할  /  문서 병합  /  다양한 형식으로 선택 항목 내보내기(PDF/TXT/DOC/HTML...)  /  PDF로 일괄 변환  /  페이지를 이미지로 내보내기  /  한 번에 여러 파일 인쇄...

컨텐츠 편집: 일괄 찾기 및 바꾸기 여러 파일에 걸쳐  /  모든 사진 크기 조정  /  테이블 행과 열 바꾸기  /  표를 텍스트로 변환...

🧹 손쉬운 청소: 쓸어버리다 추가 공간  /  섹션 나누기  /  모든 헤더  /  텍스트 상자  /  하이퍼 링크  / 더 많은 제거 도구를 보려면 다음 페이지를 방문하세요. 그룹 제거...

광고 삽입물: 삽입 천 단위 구분 기호  /  확인란  /  라디오 버튼  /  QR 코드  /  바코드  /  대각선 표  /  방정식 캡션  /  이미지 캡션  /  테이블 캡션  /  여러 장의 사진  / 더 자세히 알아보세요. 그룹 삽입...

🔍 정밀한 선택: 핀포인트 특정 페이지  /  테이블  /  모양  /  제목 단락  / 탐색 기능 향상 배우기 기능 선택...

스타 강화: 어떤 위치로든 빠르게 이동  /  반복되는 텍스트 자동 삽입  /  문서 창 간을 원활하게 전환합니다.  /  11 변환 도구...

👉 이러한 기능을 사용해 보고 싶으신가요? Word 용 Kutools는 다음을 제공합니다. 60 일 무료 사용, 제한 없음! 🚀
 

 

Comments (54)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
hello . i tried but it not go.
This comment was minimized by the moderator on the site
bonjour, je ne parviens pas à enregistrer
This comment was minimized by the moderator on the site
I have a word document that i would like some help with, in short, i have a large inspection table, items either comply, don't, further information etc. I currently use a simple drop-down option which has 5-6 options, ill like a selection option that when different options are selected, that changes the cells/row to a red or green etc, and then also (If possible) updates a Summary Table? is this possible, I'll pay someone for a general templet i can the work on....

Thank you in advance....
This comment was minimized by the moderator on the site
Hello, peter,
Did you mean to select an item from the drop down list, and a specific background color is filled for that row?
Please view the attachment to check if it is your need. If this is not your need, please give your problem more clearly.
Thank you!
This comment was minimized by the moderator on the site
Almost, by changing the drop-down tab the whole row changes color, perfect, thank you, however the magic is then coping the row (Yet only rows that don't comply or need further info etc... ) and placing it in a summary table at the top of the page in another table etc... getting them all to keep adding would be great in a summary table.

I can then alter the summary table as things change, and it updated the main parent table .... I'm not sure this is possible.

I'm happy to have a Teams Meeting to get this working, it would be apricated as it is doing my head in...

This comment was minimized by the moderator on the site
Hi, this is great, got me over a major problem with my fillable form. However, when I go to protect my fillable form, it brings up the debugger box? any idea how i can overcome this?
This comment was minimized by the moderator on the site
Thank you, i have managed to change the background colour. Is there a way i can change the text to white?
This comment was minimized by the moderator on the site
Hello, Emily,
To change the text color to white, please apply the following code:
Private Sub Document_ContentControlOnExit(ByVal ContentControl As ContentControl, Cancel As Boolean)
With ContentControl.Range
    If ContentControl.Title = "Status" Then
        Select Case .Text
            Case "Complete"
                .Cells(1).Shading.BackgroundPatternColor = wdColorRed
                .Cells(1).Range.Font.Color = wdColorWhite
            Case "In Progress"
                .Cells(1).Shading.BackgroundPatternColor = wdColorGreen
                .Cells(1).Range.Font.Color = wdColorWhite
            Case "Not Start"
                .Cells(1).Shading.BackgroundPatternColor = wdColorBlue
                .Cells(1).Range.Font.Color = wdColorWhite
            Case Else
                .Cells(1).Shading.BackgroundPatternColor = wdColorAutomatic
        End Select
    End If
End With
End Sub

Please have a try, hope it can help you!
This comment was minimized by the moderator on the site
What code do you add so it goes back to the normal colours (both background and text) when you select "Choose an item" from dropdown list after previously selecting a case
This comment was minimized by the moderator on the site
Hello, Usama,
In this case, the code in this article can help you. When uou select an item and then do back to choosing "Choose an item", the backdround color will not be filled.
Please try again. Thank you!
This comment was minimized by the moderator on the site
Well done! Is it possible to activate different cells (independent of row and column) with an item of the ContentControl... e.g. if we put the alphabet of English letters in a table with 6 rows and 5 columns and want to activate the vowels or the consonants?
This comment was minimized by the moderator on the site
Well done! Is it possible to activate different cells (independent of row and column) with an item of the ContentControl... e.g. if we put the alphabet of English letters in a table with 6 rows and 5 columns and want to activate the vowels or the consonants?
This comment was minimized by the moderator on the site
Hi I want a drop down list of colours but i do not want any text in the cells, i just want my users to be able to choose a colour as I am creating a RAG rated form.

is this possible?

thanks.
This comment was minimized by the moderator on the site
Probably way too late, but in case anyone else is wondering, you can probably do something like this by just adapting the code a bit.

adjust the range.font.color line with the same wd color code as the code above. Its not perfect but if the font is the same color as the highlight, you wont be able to visually see the difference
This comment was minimized by the moderator on the site
I have pasted the code and can see my drop down options (the text) but when I choose them, the background colors don't apply. Do you have any way to help me figure out what I may be doing wrong? Please and thank you! This is exactly what I'm hoping to do in my document, if I can make it work. Thanks!
This comment was minimized by the moderator on the site
Hello, Susan
You should check if the corresponding text in the VBA code has been mofified to your own contents.

Note: In the above code, Status is the title name when you creating the drop down list, and Complete, In Progress, Not Start are the items of the drop down list, you can change them to your own. And you can also change the color to your need.

If there is still problem after changing the text, you can upload the attachment word file and we will help you check it.
Thank you!
This comment was minimized by the moderator on the site
I am having the same issue.
I have changed the titles names in the code and followed the rest of the instructions.
Can you please tell me what I may have done wrong?
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