Skip to main content

Kutools for Office β€” One Suite. Five Tools. Get More Done.

How to insert color coded drop-down list in Word table?

Author Xiaoyang Last modified

Suppose you have a table in your Word document, and now you want to insert a color-coded drop-down list in a column of the table. This means when you select one option from the drop-down, the cell color becomes red, and when you select another, the cell color becomes green, as shown in the screenshot below:

Demo showing a cell's color changing when an item is selected from the drop-down list

Insert color coded drop-down list in Word document with VBA code

The following steps will guide you through inserting a drop-down list in a table cell and applying background color to the cell based on the selected item:

  1. Select a cell in the table where you want to insert the drop-down, and then click "Developer" > "Drop-Down List Content Control".

    Note: If you don’t see the Developer tab in the ribbon, visit: How to show the Developer tab in Word ribbon.

    Drop-Down List Content Control button on the ribbon
  2. The drop-down is inserted into the specific cell. Then click "Developer" > "Properties".
  3. Drop-down inserted into a specific cell with Properties option highlighted
  4. In the "Content Control Properties" dialog box, do the following:
    1. Enter the title name in the "Title" text box.
    2. Click the "Add" button to open the "Add Choice" dialog.
    3. Type the drop-down list item in the "Display Name" text box.
      Content Control Properties dialog box and Add Choice dialog box
  5. Repeat Step 3 to insert other drop-down list items as needed.
  6. After creating the first drop-down list, you can copy and paste it into other cells.
    Drop-down list copied to other cells
  7. Hold down ALT + F11 to open the "Microsoft Visual Basic for Applications" window.
  8. In the Microsoft Visual Basic for Applications window, double-click "ThisDocument" from the "Project" pane to open the module. Then copy and paste the following code into the blank module:
    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
    

    Note: In the code above, "Status" is the title name used when creating the drop-down list, and "Complete", "In Progress", and "Not Start" are the items. You can change these values and the corresponding colors as needed.

    VBA window with ThisDocument selected, showing code pasted into the blank module
  9. Save and close the code window. Now, when you select an item from the drop-down list, the corresponding color will fill the cell.
    Demo showing a cell's color changing when an item is selected from the drop-down list

Best Office Productivity Tools

Kutools for Word - Elevate Your Word Experience with Over 100 Remarkable Features!

πŸ€– Kutools AI Features: AI Assistant / Real-Time Assistant / Super Polish (Preserve Format) / Super Translate (Preserve Format) / AI Redaction / AI Proofread...

πŸ“˜ Document Mastery: Split Pages / Merge Documents / Export Selection in Various Formats (PDF/TXT/DOC/HTML...) / Batch Convert to PDF...

✏ Contents Editing: Batch Find and Replace across Multiple Files / Resize All Pictures / Transpose Table Rows and Columns / Convert Table to Text...

🧹 Effortless Clean: Sweap away Extra Spaces / Section Breaks / Text Boxes / Hyperlinks / For more removing tools, head to the Remove group...

βž• Creative Inserts: Insert Thousand Separators / Check Boxes / Radio Buttons / QR Code / Barcode / Multiple Pictures / Discover more in the Insert group...

πŸ” Precision Selections: Pinpoint Specific Pages / Tables / Shapes / Heading Paragraphs / Enhance navigation with more Select features...

⭐ Star Enhancements: Navigate to Any Location / Auto-Insert Repetitive Text / Toggle Between Document Windows / 11 Conversion Tools...

🌍 Supports 40+ Languages: Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Kutools and Kutools Plus tabs on the Word Ribbon
πŸ‘‰ Want to try these features? Download Kutools for Word now! πŸš€
 

✨ Kutools for Office – One Installation, Five Powerful Tools!

Includes Office Tab Pro Β· Kutools for Excel Β· Kutools for Outlook Β· Kutools for Word Β· Kutools for PowerPoint

πŸ“¦ Get all 5 tools in one suite | πŸ”— Seamless integration with Microsoft Office | ⚑ Save time and boost productivity instantly

Best Office Productivity Tools

Kutools for Word - 100+ Tools for Word