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 1089313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:12:09+00:00 2026-05-16T23:12:09+00:00

I have two columns in a spreadsheet called A1 and A2. The data entered

  • 0

I have two columns in a spreadsheet called A1 and A2. The data entered can only be either “Y” or “N”. However, A1 and A2 cannot have the same entry for the same record. For example, if the value of A1 is “Y” in record#3, then the value of A2 in record#3 must be “N”. and cannot be “Y”. Also, if A1 in record#3 is “N”, the A2 must be “Y”. In othe words, A1 and A2 can NOT have the same entry in the same record.
Does it make sense?
what will be the best way to do it? using VBA? or using the sheet controls ?

so far, I wrote a simple condition in the Submit_click sub as:
if Range (A1).value=Range(A2).value then
MsgBox(“…..”)

but this conflicts with the save function that I have in the Worksheet_beforeClose. When the user closes the worksheet without submittion, a message appears and warning the user that he/she forgot to submit. But the current problem I am facing is, if the user enters “Y” for both A1 and A2, and then he/she closes the worsheet before submitting, the warning message (do you want to submit?) is displayed to the user and as soon as the user responds by “Yes”, the other validation message is displayed because A1 and A2 have the same value “Y”. Then the program just closed without submitting .

Please guide me ,

  • 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-16T23:12:10+00:00Added an answer on May 16, 2026 at 11:12 pm

    put this in the Worksheet_Change event. It will correct the values after the cell is edited.

    Const c1pos = 1
    Const c2pos = 2
    
    Application.EnableEvents = False
    
    Select Case Target.Column
        Case c1pos
            If UCase(Target.Value) = "Y" Then
                ActiveSheet.Cells(Target.Row, c1pos) = "Y"
                ActiveSheet.Cells(Target.Row, c2pos) = "N"
            Else
                ActiveSheet.Cells(Target.Row, c1pos) = "N"
                ActiveSheet.Cells(Target.Row, c2pos) = "Y"
            End If
        Case c2pos
            If UCase(Target.Value) = "Y" Then
                ActiveSheet.Cells(Target.Row, c1pos) = "N"
                ActiveSheet.Cells(Target.Row, c2pos) = "Y"
            Else
                ActiveSheet.Cells(Target.Row, c1pos) = "Y"
                ActiveSheet.Cells(Target.Row, c2pos) = "N"
            End If
    End Select
    
    Application.EnableEvents = True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables with the same columns, and I need to copy one
I have two tables with the same columns tbl_source (ID, Title) tbl_dest (ID, Title)
I have two LINQ objects which have exactly the same columns and I would
I have two columns in Excel, like this: A B 0.5 0.4 0.6 0.59
I have the following two columns: SELECT b.ip_address AS IP ,b.mask AS MASK FROM
I have two tables with the following columns: table1: id, agent_name, ticket_id, category, date_logged
I have a listview with two columns and I'm using a context menu to
I have two Tables. Order - With Columns OrderID, OrderStatusID OrderStatus - With Columns
I have two tables in my database: NEWS table with columns: id - the
I have a table y Which has two columns a and b Entries are:

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.