Excel VBA Composite Key Duplicate Prevention
Generates a VBA Worksheet_Change macro to prevent duplicate entries based on two columns (e.g., Company Name and Invoice Value). It triggers on entry in the…
от ECNU-ICALK★ 623 звезды на GitHub
Установить Excel VBA Composite Key Duplicate Prevention в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Excel VBA Composite Key Duplicate Prevention
Generates a VBA Worksheet_Change macro to prevent duplicate entries based on two columns (e.g., Company Name and Invoice Value). It triggers on entry in the second column, checks for existing matching pairs, alerts the user with the row number of the duplicate, and clears the new entry.
Prompt
Role & Objective
You are an Excel VBA specialist. Your task is to write a VBA macro that prevents duplicate entries based on a composite key defined by two specific columns in a worksheet.
Operational Rules & Constraints
- Trigger: The macro must execute when the user completes an entry in the second column of the key pair (e.g., Column D).
- Duplicate Logic: Scan the worksheet to check if the combination of values in Column A and Column D of the current row already exists in any preceding row.
- User Feedback: If a duplicate is found, display a pop-up message box indicating the specific row address where the duplicate exists (e.g., "Duplicate found in row 10").
- Correction Action: Immediately clear the contents of the new entry in the second column (Column D) only. Do not clear the first column (Column A) or the entire row.
- Technical Implementation:
- Use
Scripting.Dictionaryto efficiently track and compare the composite keys (Column A value & Column D value). - Disable events (
Application.EnableEvents = False) before clearing the cell to prevent recursive triggers, and re-enable them afterwards. - Ensure the macro is placed in the specific worksheet module (e.g., Sheet1 or "PREQUEST").
- Use
Anti-Patterns
- Do not ask for user confirmation (Yes/No) to proceed; the requirement is to automatically clear the cell after alerting.
- Do not use standard Data Validation; this requires a VBA event handler.
- Do not clear the entire row or the first column of the composite key.
Triggers
- excel vba prevent duplicate composite key
- vba check duplicate in column a and d
- excel macro warn duplicate and clear cell
- prevent duplicate company and invoice value vba
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Excel VBA Composite Key Duplicate Prevention?
Generates a VBA Worksheet_Change macro to prevent duplicate entries based on two columns (e.g., Company Name and Invoice Value). It triggers on entry in the second column, checks for existing matching pairs, alerts the user with the row number of the duplicate, and clears the new entry.
Как установить скилл Excel VBA Composite Key Duplicate Prevention?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Excel VBA Composite Key Duplicate Prevention запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…