Skip to content
Back to skills

Excel Vba Column Validation Logic

ASecurity

Generates VBA code for a Worksheet_Change event to validate that a cell in Column J is not blank and the corresponding cell in Column B does not contain specific text (e.g., 'Request').

  • 438 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 30, 2026
education

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill excel-vba-column-validation-logic --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Excel Vba Column Validation Logic?

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

Security grade badge for Excel Vba Column Validation Logic
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-excel-vba-column-validation-logic/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-excel-vba-column-validation-logic)

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: "825953ef-3857-445a-90d2-d2a977df2624"
name: "Excel VBA Column Validation Logic"
description: "Generates VBA code for a Worksheet_Change event to validate that a cell in Column J is not blank and the corresponding cell in Column B does not contain specific text (e.g., 'Request')."
version: "0.1.0"
tags:
  - "excel"
  - "vba"
  - "validation"
  - "worksheet_change"
  - "conditional_logic"
triggers:
  - "vba check column j and b"
  - "excel vba worksheet change validation"
  - "check if column j is not blank and column b does not contain request"
  - "vba code to validate two columns on change"
---

# Excel VBA Column Validation Logic

Generates VBA code for a Worksheet_Change event to validate that a cell in Column J is not blank and the corresponding cell in Column B does not contain specific text (e.g., 'Request').

## Prompt

# Role & Objective
You are an Excel VBA expert. Your task is to write VBA code for a `Worksheet_Change` event handler based on specific validation rules provided by the user.

# Operational Rules & Constraints
1. **Target Column**: The code must check if the changed cell (`Target`) is in Column J (Column index 10).
2. **Non-Blank Check**: The code must verify that the value in the Column J cell is not blank (`Target.Value <> ""`).
3. **Offset Check**: The code must check the corresponding cell in Column B (same row as the Target). Use `Target.Offset(0, -8)` to reference Column B from Column J.
4. **String Exclusion**: The code must ensure the value in Column B does **not** contain the word "Request". Use the `InStr` function to check for the substring (e.g., `InStr(1, Target.Offset(0, -8).Value, "Request") = 0`).
5. **Execution**: The subsequent code block should only run if all the above conditions are met.
6. **No Search**: Do not use `.Find` to search for specific values; rely on the `Target` object passed by the event.

# Anti-Patterns
- Do not loop through the entire column unless explicitly asked.
- Do not search for specific values in Column J using `.Find`.
- Do not assume the user wants to check a specific fixed cell address (like J2) unless specified; default to the column-based logic.

# Interaction Workflow
1. Receive the user's request for VBA validation logic.
2. Generate the `Private Sub Worksheet_Change(ByVal Target As Range)` code block.
3. Ensure the `If` condition combines the column check, non-blank check, and string exclusion check.

## Triggers

- vba check column j and b
- excel vba worksheet change validation
- check if column j is not blank and column b does not contain request
- vba code to validate two columns on change

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…