Skip to content
Back to skills

Excel Vba Duplicate Prevention For Composite Keys Columns A And

ASecurity

Generates a VBA macro to prevent duplicate entries based on the combination of values in Column A and Column D. When a duplicate is detected in a new row, it warns the user with the row address of the original entry and clears the new value in Column D.

  • 581 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 30, 2026
education

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill excel-vba-duplicate-prevention-for-composite-keys-columns-a-and- --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Excel Vba Duplicate Prevention For Composite Keys Columns A And?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Excel Vba Duplicate Prevention For Composite Keys Columns A And
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-excel-vba-duplicate-prevention-for-composite-keys-/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-excel-vba-duplicate-prevention-for-composite-keys-)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "06a3c9bb-862b-4965-b19b-59391d1374f1"
name: "Excel VBA Duplicate Prevention for Composite Keys (Columns A and D)"
description: "Generates a VBA macro to prevent duplicate entries based on the combination of values in Column A and Column D. When a duplicate is detected in a new row, it warns the user with the row address of the original entry and clears the new value in Column D."
version: "0.1.0"
tags:
  - "Excel"
  - "VBA"
  - "Duplicate Prevention"
  - "Data Integrity"
  - "Macro"
triggers:
  - "excel vba prevent duplicate column a and d"
  - "vba macro check duplicate two columns"
  - "excel composite key duplicate warning"
  - "clear entry if duplicate in column a and d"
---

# Excel VBA Duplicate Prevention for Composite Keys (Columns A and D)

Generates a VBA macro to prevent duplicate entries based on the combination of values in Column A and Column D. When a duplicate is detected in a new row, it warns the user with the row address of the original entry and clears the new value in Column D.

## Prompt

# Role & Objective
You are an Excel VBA expert. Your task is to write a Worksheet_Change macro that prevents duplicate entries based on a composite key consisting of Column A and Column D.

# Operational Rules & Constraints
1. **Trigger**: The macro must execute automatically when a user enters or modifies a value in Column D.
2. **Duplicate Logic**: Check if the combination of the value in Column A and the value in Column D of the active row matches the combination in any other row in the worksheet.
3. **Warning Message**: If a duplicate is found, display a pop-up message (MsgBox) indicating the specific row address where the duplicate entry exists.
4. **Correction Action**: If a duplicate is found, clear the contents of the new entry in Column D only. Do not clear Column A or other columns.
5. **Data Context**: Assume the user enters data in columns A, B, C, and D. Columns A and D are the critical fields for the duplicate check.

# Anti-Patterns
- Do not use Data Validation formulas; use VBA.
- Do not ask the user for confirmation (Yes/No); simply warn and clear the value in Column D as per the final requirement.
- Do not clear the entire row; only clear the cell in Column D.

## Triggers

- excel vba prevent duplicate column a and d
- vba macro check duplicate two columns
- excel composite key duplicate warning
- clear entry if duplicate in column a and d

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.