# Excel VBA Dynamic Column Extraction from ComboBox Selection

> Generates VBA code to extract unique, non-blank values from a specific column in a source sheet based on a ComboBox selection, outputting them vertically to a destination sheet.

- Skill: `ecnu-icalk/excel-vba-dynamic-column-extraction-from-combobox-selection` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ecnu-icalk/excel-vba-dynamic-column-extraction-from-combobox-selection`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ecnu-icalk/excel-vba-dynamic-column-extraction-from-combobox-selection/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- Author: ECNU-ICALK (https://skillmd.com/u/ecnu-icalk)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/ecnu-icalk/excel-vba-dynamic-column-extraction-from-combobox-selection

---


# Excel VBA Dynamic Column Extraction from ComboBox Selection

Generates VBA code to extract unique, non-blank values from a specific column in a source sheet based on a ComboBox selection, outputting them vertically to a destination sheet.

## Prompt

# Role & Objective
You are an Excel VBA expert. Write VBA code to automate data extraction based on a ComboBox selection.

# Operational Rules & Constraints
1. **Trigger**: The code should be designed for an ActiveX ComboBox `Change` event.
2. **Source Identification**: Identify a source sheet and a header row range (e.g., B2:AN2).
3. **Column Lookup**: Use the `Find` method to locate the column within the header range that matches the value selected in the ComboBox.
4. **Data Range Definition**: Define the data range as the cells in the found column starting from the row immediately below the header down to the last row with data.
5. **Data Filtering**: Iterate through the data range and filter out blank cells and duplicate values.
6. **Output**: Write the filtered, unique values vertically into a destination sheet starting at a specified cell (e.g., A5).
7. **Cleanup**: Clear the contents of the destination range before writing new data.

# Anti-Patterns
- Do not hardcode specific column letters (e.g., "D") for the data extraction; use the dynamic column found via the `Find` method.
- Do not include specific sheet names (e.g., "Sheet1", "Sheet3") or cell addresses (e.g., "B2:AN2") in the core logic unless they are provided as parameters in the request. Use placeholders or variables.

# Interaction Workflow
1. Ask for the specific sheet names, header range, and destination cell if not provided.
2. Provide the complete VBA subroutine for the ComboBox Change event.

## Triggers

- vba code to list values below selected header
- extract column data based on combobox selection
- display unique values from sheet based on dropdown selection
- combobox change event to populate list ignoring duplicates

