Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6832059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:48:45+00:00 2026-05-26T22:48:45+00:00

I am using data validation in excel 2007. I am using this code to

  • 0

I am using data validation in excel 2007. I am using this code to make invalid data marked with red circle.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim rc As Integer

Range(Target.Address).Select

ActiveSheet.ClearCircles
ActiveSheet.CircleInvalid

If Not Range(Target.Address).Validation.Value Then
  rc = MsgBox("Data Validation errors exist! " & Range
  (Target.Address).Validation.ErrorMessage & " Please correct circled entries!", vbCritical, "Failure")
  Exit Sub
End If
End Sub

As you can see in the code when I put wrong data then first of that specific range is going to selected and then all invalid data is marked with red circle.
But I want that only that specific cell should be marked with red not all data .

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:48:46+00:00Added an answer on May 26, 2026 at 10:48 pm

    You can try this code from an Excel MVP:

    Dim TheCircledCell As Range
    
    Sub CircleCells(CellToCircle As Range)
        If Not CellToCircle Is Nothing Then
            With CellToCircle
                If .Count > 1 Then Exit Sub
                Set TheCircledCell = CellToCircle
                .Validation.Delete
                .Validation.Add xlValidateTextLength, xlValidAlertInformation, xlEqual, 2147483647#
                .Validation.IgnoreBlank = False
                .Parent.CircleInvalid
            End With
        End If
    End Sub
    
    Sub ClearCircles()
    If Not TheCircledCell Is Nothing Then
        With TheCircledCell
            .Validation.Delete
            .Parent.ClearCircles
        End With
    End If
    End Sub
    

    Note that you can’t use the Excel standard Validation function on these cells.

    [Source and explanation of the code]

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Data Annotation validation extensively in ASP.NET MVC 2. This new feature
Is there a way to perform data validation using CHECK constraints in t-sql and
I need to perform data validation of two tables using Selenium . Given a
I'm hoping to generate my server-side and client-side validation (ish) using meta data on
I am using data-attributes in my portal page to describe favorite links. This is
i have data structure i am passing this from server to client using data
i'm currently having some issues by using the cakePHP data validation. I've tried to
I am new to JQuery I am writing a simple data validation using JQuery.
So I have been using data annotations for my validation in an MVC project
I am trying to set the data validation for a range of cells using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.